[rspec-devel] [ rspec-Bugs-6980 ] Can't set expectations on Rails association proxy object
noreply at rubyforge.org
noreply at rubyforge.org
Thu Nov 30 18:41:46 EST 2006
Bugs item #6980, was opened at 2006-11-30 05:34
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6980&group_id=797
Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Pat Maddox (pergesu)
Assigned to: Nobody (None)
Summary: Can't set expectations on Rails association proxy object
Initial Comment:
edge rails, 0.7.3
context "Given a call to destroy, a Person" do
setup do
@person = Person.create :name => "Me", :user_id => 1
@person.add_item Item.new(:name => "Item")
end
specify "should destroy its items" do
@person.items.should_receive(:delete_all)
@person.destroy
end
end
This assumes the following config in Person.rb
has_many :items, :dependent => :delete_all
The failure is:
NoMethodError in 'Given a call to destroy, a Person should destroy its items'
undefined method `receive?' for Item:Class
My best guess is that since items is a proxy class defined at runtime, the should_receive method isn't getting mixed into it.
----------------------------------------------------------------------
>Comment By: David Chelimsky (dchelimsky)
Date: 2006-11-30 23:41
Message:
Have you tried this against 1.1.6? Just curious.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=6980&group_id=797
More information about the rspec-devel
mailing list