Sha256: 9c2e5bd753a41a303806154b4156b11802cb12ace82ddc370da4937e76c9a31c

Contents?: true

Size: 1.09 KB

Versions: 89

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

describe FbGraph::Auth::Cookie, '.parse' do
  let(:client) { Rack::OAuth2::Client.new(:identifier => 'client_id', :secret => 'client_secret') }
  let :cookie do
    {
      'fbsr_client_id' => "9heZHFs6tDH/Nif4CqmBaMQ8nKEOc5g2WgVJa10LF00.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiI4ZDYwZDY4NDA4MmQ1NjczMjY3MWUxNzAuMS01Nzk2MTIyNzZ8N2pkVlp6MlNLNUY2b0gtQ21FQWtZZVpuVjEwIiwiaXNzdWVkX2F0IjoxMzEyOTUzOTcxLCJ1c2VyX2lkIjo1Nzk2MTIyNzZ9"
    }
  end

  shared_examples_for :parsable_cookie do
    it 'should be parsable' do
      data[:algorithm].should == 'HMAC-SHA256'
      data[:code].should      == '8d60d684082d56732671e170.1-579612276|7jdVZz2SK5F6oH-CmEAkYeZnV10'
      data[:issued_at].should == 1312953971
      data[:user_id].should   == 579612276
    end
  end

  context 'when whole cookie is given' do
    let(:data) { FbGraph::Auth::Cookie.parse(client, cookie) }
    it_behaves_like :parsable_cookie
  end

  context 'when actual cookie string is given' do
    let(:data) { FbGraph::Auth::Cookie.parse(client, cookie['fbsr_client_id']) }
    it_behaves_like :parsable_cookie
  end
end

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
fb_graph-2.7.17 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.16 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.15 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.14 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.13 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.12 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.11 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.10 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.9 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.8 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.7 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.6 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.5 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.4 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.3 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.2 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.1 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.7.0 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.6.7 spec/fb_graph/auth/cookie_spec.rb
fb_graph-2.6.6 spec/fb_graph/auth/cookie_spec.rb