Re: [rspec-users] stubbing association methods in controller spec

2009-08-04 Thread norm
that worked! thanks David, your help is much appreciated ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] stubbing association methods in controller spec

2009-07-30 Thread norm
I have two models: Student has_many=>:grad_surveys and GradSurvey belongs_to=>:student I am testing the GradSurveysController#update method with it "should only allow update if the correct token is presented" do @params = {:id=>"1", :token=>"ab56e1b47", :survey=>{}} @mock_grad_s

Re: [rspec-users] passing parameters when testing controller actions

2009-07-29 Thread norm
wow, thanks for the tips David. I'm using both the stub!() and the should_receive() because, as a complete RSpec neophyte, that's what I thought was required! (And it seemed to work, too!). I didn't suspect the controller code, because it's code that works. But with your suggestion, I found the di

[rspec-users] passing parameters when testing controller actions

2009-07-28 Thread norm
My grad_surveys_controller has a student_edit method. An id parameter is passed in the url and a token is passed in a query string. For example: http://www.example.com/students/34/grad_surveys/21/student_edit?token=ab56e1b47 so the params hash should contain {"controller"=>"grad_surveys"

[rspec-users] basic noob question

2009-07-24 Thread norm
I'm struggling mightily! I have a controller called Govtpositions, and I'm just trying to test the standard Rails 'create' method. So it seems as if three examples would be appropriate... one to test the instantiation of the new model from the params hash, another to test that it was saved, and th

[rspec-users] basic noob questions

2009-07-24 Thread norm
Struggling mightily! Testing a controller called Govtpositions. Just focusing on testing the create method for the moment. I would imagine there should be two examples for a successful save... instantiate the model object and then save it, is that right? So just to test the model object instantia