bcardarella/valid_attribute — Issue #18: What am I missing?
Author: bryanrite
Created: 2011-12-21 01:17:20+00:00
State: open

I'm not sure if this is a bug, but I have the following issue:

I have a very basic setup:

```ruby
class Book < ActiveRecord::Base
belongs_to :customer
validates :customer_id, presence: true
end
```

And in my RSpec file:

```ruby
subject { Book.new, :customer_id => 2 }

it "works" do
subject.customer_id = nil
subject.should_not have_valid(:customer_id)
end
```

But the following doesn't work:

```ruby
it { should_not have_valid(:customer_id).when(nil) }
```

I get the error:

```ruby
expected Book#customer_id to reject the value: nil
```

As I understand it, they should be the same? Am I missing something?