Sha256: 1c83ad7dd5d05e34afcd874d5f07070b665f9767dc84986592a6dc7920a07459

Contents?: true

Size: 924 Bytes

Versions: 2

Compression:

Stored size: 924 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', :js => true do
    visit '/facebook_api.html'
    page.should have_content "Hi, Tester 1"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puffing-billy-0.2.1 spec/features/examples/facebook_api_spec.rb
puffing-billy-0.2.0 spec/features/examples/facebook_api_spec.rb