> Not sure why you are stubbing entries on the controller ... entries is > called on the current user ...
I have this method. I want to use this variable to loop the users @entries. So I'm testing to see that this variable is tested and works correctly. def main @entries = current_user.entries end I tried your suggestion @current_user = mock_model(User, :id => 1, :entries => [EMAIL PROTECTED]) My error "Mock 'User_1010' received unexpected message :entries with (no args)" Maybe this is overtesting or not really necessary to test. Let me know. ---------------------------------- I'm testing this out ---------------------------------- def main @entries = current_user.entries end ------------------------------------------ Using this spec ------------------------------------------ before(:each) do @current_user = mock_model(User, :id => 1) @entry = mock_model(Entry, :user_id => 1) controller.stub!(:current_user).and_return(@current_user) controller.stub!(:login_required).and_return(:true) controller.stub!(:entries).and_return(@entry) end describe "on the main page" do it "should show all the current entries for the user" do @current_user = mock_model(User, :id => 1, :entries => [EMAIL PROTECTED]) get :main end end _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users