Hi All,
I got the redirect to work with:
def do_post
post :create, {:motion => do_motion_input("ten")}
end
it "creates new proposal with proposer set" do
do_post
response.should be_success
end
it "once motion is saved redirects to show motion" do
@motion = motions(:ten)
@motion.stub!(:new_record?).and_return(false)
Motion.stub!(:new).and_return(@motion)
@motion.stub!(:save).and_return(@motion)
do_post
response.should redirect_to("motions/10")
end
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,
Harry
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users