thoughtbot/shoulda-matchers — pull request #567 by mcls (2014-08-07 14:32:14+00:00)
Title: Get validates_uniqueness_of to work better with `NOT NULL` columns

Instead of having to persist the subject, like so:

```ruby
describe 'validations' do
subject { build(:model) }
it { validates_presence_of :required_attr }
context "persisted" do
# Needs to be persisted to prevent NOT NULL db error
subject { create(:model) }
it { validates_uniqueness_of :unique_attr }
end
end
```

You can now just write:

```ruby
describe 'validations' do
subject { build(:model) }
it { validates_presence_of :required_attr }
it { validates_uniqueness_of :unique_attr }
end
```

When required the matcher saves the record to the database.