[rspec-users] can't seem to test redirect?

Harry Bishop lists at ruby-forum.com
Fri Oct 24 19:39:54 EDT 2008

Hi All,
I got the redirect to work with:

  def do_post
    post :create, {:motion => do_motion_input("ten")}

  it "creates new proposal with proposer set" do
    response.should be_success

  it "once motion is saved redirects to show motion" do
    @motion = motions(:ten)
    response.should redirect_to("motions/10")

Seems I had a little wrong with each combination of lines I tried. 
Thanks Pat for the input about testing only one response.  I stubbed out 
the last response I was trying to test. In my several hours of doing 
this I'm not sure whether something didn't get saved before a test but 
it isn't clear to me what the pattern should be.  I found that using 
fixtures seems cleaner to me as far as getting the right input although 
I'm seeing that most users are relying on mocks. I tried mocks but it 
seems my tests are sensitive. Obviously I'm not yet getting it.  Not 
sure why more people don't use fixtures.  I used them in unit and 
functional tests and didn't have any problems there.  Hopefully my 
productivity with rspec will improve from here.

Thanks for your help,
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list