Pat Maddox wrote:
> Harry Bishop <[EMAIL PROTECTED]> writes:
>
>> format.html { redirect_to(@motion) }
>>
>> TIA,
>> Harry
>
> Can you post your example code as well? Also, are there any errors?
> Here are my two guesses at this point:
>
> * you forgot to make a request in the example (post :create)
> * there's some error that is keeping the action from getting to the
> redirect
>
> Also, what is the value of response.code in the example?
>
> Pat
Hi Pat,
My examples code is
before(:each) do
login_as(:username)
@motion = mock(motions(:four))
@motion.stub!(:new_record?).and_return(true)
Motion.stub!(:new).and_return(@motion)
@motion.stub!(:save).and_return(@motion)
controller.stub!(:redirect_to).with(@motion).and_return(true)
end
def do_post
post :create, {:motion => do_motion_input("ten")} #reads yml input
as hash
end
it "create new proposal with proposer set" do
do_post
response.should be_success
response.should render_template("motions/create")
response.should redirect_to(@motion)
end
The only error is the "got no redirect"
response.code is 200
HR
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users