File: signed_request_test.rb

package info (click to toggle)
ruby-omniauth-facebook 4.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 244 kB
  • sloc: ruby: 817; makefile: 3
file content (26 lines) | stat: -rw-r--r-- 726 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'helper'
require 'omniauth/facebook/signed_request'

class SignedRequestTest < Minitest::Test
  def setup
    @value = fixture('signed_request.txt').strip
    @secret = "897z956a2z7zzzzz5783z458zz3z7556"
    @expected_payload = JSON.parse(fixture('payload.json'))
  end

  def test_signed_request_payload
    signed_request = OmniAuth::Facebook::SignedRequest.new(@value, @secret)
    assert_equal @expected_payload, signed_request.payload
  end

  def test_signed_request_parse
    payload = OmniAuth::Facebook::SignedRequest.parse(@value, @secret)
    assert_equal @expected_payload, payload
  end

  private

  def fixture(name)
    File.read(File.expand_path("fixtures/#{name}", File.dirname(__FILE__)))
  end
end