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

Harry Bishop lists at ruby-forum.com
Fri Oct 24 13:15:14 EDT 2008

I'm posting to the create action and seeing the line "at the motion save
part of create in the following:

  def create
    @motion = Motion.new(params[:motion])
    respond_to do |format|
      if @motion.save
        puts "at the motion save part of create"
        flash[:notice] = 'Motion was successfully created. Needs a
        format.html { redirect_to(@motion) }

but when I insert the line in motions_controller_spec.rb

response.should redirect_to(@motion)

I receive "got no redirect"
expected redirect to #<Spec::Mocks::Mock:0x112ec96 @name=#<Motion id:
20, title:........>>, got no redirect

Is there something missing in the test?

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list