Sha256: c79429a7e9bcd6e970e8baa780835d10a3d1972040337503ee58704b71df3155

Contents?: true

Size: 854 Bytes

Versions: 10

Compression:

Stored size: 854 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
require 'rack/facebook_session'
require 'rack/lint'
require 'rack/mock'

class Rack::FacebookSessionTest < Test::Unit::TestCase

  def setup
    @app = lambda do |env|
      @env = env
      Rack::Response.new().to_a
    end

    @facebook = Rack::FacebookSession.new(@app, '_top_sekrit')
  end

  def params(p)
    p.map{|*args| args.join('=') }.join('&')
  end

  def app
    Rack::MockRequest.new(Rack::Lint.new(@facebook))
  end

  def test_converts_session_key_on_get
    response = app.get '/?' + params(:fb_sig_session_key => 'foo')
    assert_equal '_top_sekrit=foo', @env['HTTP_COOKIE']
  end

  def test_converts_session_key_on_post
    response = app.post '/', :input => params(:fb_sig_session_key => 'foo')
    assert_equal '_top_sekrit=foo', @env['HTTP_COOKIE']
  end
end

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
facebooker-1.0.75 test/rack/facebook_session_test.rb
sentientmonkey-facebooker-1.0.74 test/rack/facebook_session_test.rb
facebooker-micah-1.0.74 test/rack/facebook_session_test.rb
facebooker-1.0.74 test/rack/facebook_session_test.rb
facebooker-1.0.73 test/rack/facebook_session_test.rb
facebooker-1.0.72 test/rack/facebook_session_test.rb
facebooker-1.0.71 test/rack/facebook_session_test.rb
facebooker-1.0.70 test/rack/facebook_session_test.rb
benhutton-facebooker-1.0.69.2 test/rack/facebook_session_test.rb
benhutton-facebooker-1.0.69.1 test/rack/facebook_session_test.rb