I am trying to spec a controller that sets up a page to add two instances of an object to another (many to many :through).
In my controller_spec, I have the following statements: Student.should_receive(:new).and_return(mock_student) mock_student.should_receive(:relatives).twice mock_student.relatives.should_receive("<<").with(Relative.new(:parent => Parent.new)).twice When I run the test, I get the following error message: Spec::Mocks::MockExpectationError in 'StudentsController responding to GET new should expose a new student as @student' Mock 'NilClass' expected :<< with (#<Relative id: nil, parent_id: nil, student_id: nil, created_at: nil, updated_at: nil, child_lives_with: nil>) but received it with (#<Relative id: nil, parent_id: nil, student_id: nil, created_at: nil, updated_at: nil, child_lives_with: nil>) It seems what it is receiving and expecting are the same. Any ideas would be greatly appreciated. Tom -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users