Hi, I'm new to RSpec. I have a question about how to write controller specs.
Here's a code generated by scaffolding (with Rspec). def do_get get :index end it "should be successful" do do_get response.should be_success end it "should render index template" do do_get response.should render_template('index') end it "should find all books" do Book.should_receive(:find).with(:all).and_return([EMAIL PROTECTED]) do_get end it "should assign the found books for the view" do do_get assigns[:books].should == [EMAIL PROTECTED] end end ################### What I don't understand is that, sometimes, "get" is done before an expectation(i.e., a line that contains "should"), but other times, the order is the opposite. In the third spec above, the sentence that has "should" comes first and do_get later. In my view, "get :index" needs to be done first to trigger "index" action. And the "index" action should trigger "Book.should_receive(:find).....". I'm a bit confused about all of this. Mike
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users