On Oct 26, 2007, at 5:39 pm, Tarsoly András wrote: > http://pastie.caboo.se/111221 > > I've tried everything, like stubbing out :update_attributes! , even > tested it in real-life and it works like a charm: updates / creates > new records nicely and everything else is working properly.
First, like David said earlier, you're putting too much into one spec: it "should retrieve the Option instance identified by ID" do CalciumOption.should_receive(:find).with("1").and_return(@option) @option.should_receive(:update_attributes!).with (invalid_option_attributes).and_raise(ActiveRecord::RecordInvalid) post :update, :id => 1, :option => invalid_option_attributes end should really be it "should retrieve the Option instance identified by ID" do CalciumOption.should_receive(:find).with("1").and_return(@option) post :update, :id => 1, :option => invalid_option_attributes end it "should update the Option instance's attributes" do @option.should_receive(:update_attributes!).with (invalid_option_attributes).and_raise(ActiveRecord::RecordInvalid) post :update, :id => 1, :option => invalid_option_attributes end Also I don't think you need '@option = ' in front of @option.update_attributes!, as that method call modifies the object in-place. But that's a Rails issue. One other thing - you aren't stubbing CalcumOption.find in 'Admin::OptionsController, "#update (POST) with valid params"'. Are you sure this isn't loading real models? As for the actual problem you asked about... sorry but I am lost. I've looked over it about 5 times and everything I thought was wrong was me not paying attention. I can't see ANY reason it should fail. Is it still not working? Ashley -- blog @ http://aviewfromafar.net/ linked-in @ http://www.linkedin.com/in/ashleymoran currently @ home _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users