Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  it "should authenticate successfully" do
    mock_open_id_consumer("http://newuser.example.com", {'email' => 'newuser@example.com'})
    
    lambda {
      post :create, :openid_url => "http://newuser.example.com", :open_id_complete => '1'
    }.should change(User, :count)
    @response.should be_redirect
    @response.should redirect_to(orders_url)
  end

  def mock_open_id_consumer(identity_url, registration={})
    @controller.should_receive(:open_id_consumer).and_return(stub('openid_consumer', {
      :complete => stub('completion_object', {
        :status => OpenID::SUCCESS,
        :identity_url => identity_url,
        :extension_response => registration
      })
    }))
  end