On Thu, Mar 13, 2008 at 3:54 PM, Oliver Barnes <[EMAIL PROTECTED]> wrote: > thanks pat, it's still a good primer ;) > > I'm getting a better handle at it, but I'm still confused as to how to > test assigment of associated objects. for instance, how do I test this > (using attachment_fu)? > > @work.image = @image
You could either use an interaction-based or state-based test. it "should assign the work image" do @mock_work.should_receive(:image=).with(@mock_image) end it "should assign the work image" do Work.find(3).image.should_not be_nil end The basic idea is that you're specifying that it receives a method call that you know works, or you can verify some state that should be true once the action has taken place. hth Pat _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users