views:

76

answers:

0

I have a functional test that is supposed to call ROTS (Ruby Openid Test Server) to act as an identity.

In my UsersControllerTest, I have the following:

      test "creating a user" do
        get :create, :user => {
                          :username => "woot",
                          :email => "[email protected]",
                          :persistence_token => '6cde0674657a8a313ce952df979de2830309aa4c11ca6...',
                          :openid_identifier => 'http://localhost:1123/john.doe?openid.success=true'      
        }
        assert_response :redirect
    # up to this point, the test passes. The following fails
        assert_equal(User.all.count, 1)
  end

Problem iss, I don't know how to continue writing the test after the 'assert_response :redirect' as I know that the identity server needs to return something so that it would continue the block of code.

What should I do to simulate that the identity has been confirmed by the identity server?

Here's what my code look like in my User Controller

  def create
    @user = User.new(params[:user])
    @user.save do |result|
      if result
        flash[:notice] = "Registration successful."
        redirect_to "/"
      else
        render :action => 'new'
      end
    end
  end