Sha256: 26809e0fd91ef9b63cc5e384e515f6afa64154ea50be95444d2713667455af16

Contents?: true

Size: 928 Bytes

Versions: 3

Compression:

Stored size: 928 Bytes

Contents

require 'spec_helper'
require 'base64'

describe 'Facebook API example', :type => :feature, :js => true do
  before do
    proxy.stub('https://www.facebook.com:443/dialog/oauth').and_return(Proc.new { |params,_,_|
      # mock a signed request from facebook.  the JS api never verifies the
      # signature, so all it needs is the base64-encoded payload
      signed_request = "xxxxxxxxxx.#{Base64.encode64('{"user_id":"1234567"}')}"
      # redirect to the 'redirect_uri', with some extra crap in the query string
      {:redirect_to => "#{params['redirect_uri'][0]}&access_token=foobar&expires_in=600&base_domain=localhost&https=1&signed_request=#{signed_request}"}
    })

    proxy.stub('https://graph.facebook.com:443/me').and_return(:jsonp => {:name => 'Tester 1'})
  end

  it 'should show me as logged-in' do
    visit '/facebook_api.html'
    click_on "Login"
    expect(page).to have_content "Hi, Tester 1"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puffing-billy-0.4.1 spec/features/examples/facebook_api_spec.rb
puffing-billy-0.4.0 spec/features/examples/facebook_api_spec.rb
puffing-billy-0.3.0 spec/features/examples/facebook_api_spec.rb