I'm trying to test some code that can loop once or multiple times and assign some values to another object. I want to test one of the values being assigned to the object in the loop.
e.g. class Foo def bar values = returns_an_array_of_values baz = Baz.new values.each_with_index do |value, index| baz.field1 = Constant baz.field2 = index baz.field3 = value end end end it "should assign increasing index values to field3" do quxxo = mock Baz.stub!(:new => quxxo) quxxo.should_receive(:field2=).with(1,2,3) end This doesn't work. I tried a few different variants. quxxo.should_receive(:field2=).with(1).with(2).with(3) that doesn't work either. Any suggestions on how to set expectations for a single mock to receive the same message multiple time with different arguments with the express purpose of validating the arguments? Thanks... cr _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users