On Mon, Aug 24, 2009 at 6:09 PM, jg<[email protected]> wrote:
> I have a very fairly simple spec
>
> it "should assign an instance variable" do
>   get 'new'
>   assigns[:city].should == City.new
> end
>
> In my controller
>
> def new
> �...@city = City.new
> end
>
> but when I run it, I get
>
> 'CitiesController GET 'new' should assign an instance variable' FAILED
> expected: #<City id: nil, name: nil, created_at: nil, updated_at:
> nil>,
>         got: #<City id: nil, name: nil, created_at: nil, updated_at:
> nil> (using ==)
>
> Those two things seem to be equal, am I wrong there?

According to ActiveRecord, two objects with nil IDs are not considered
to be equal. Try this in script/console and you'll see:

$ City.new == City.new
=> false

HTH,
David
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to