Sha256: 61d40d382a24b846f4ccf2a5971e691f88b73bc77c6328f899674c895906c98e

Contents?: true

Size: 1.75 KB

Versions: 8

Compression:

Stored size: 1.75 KB

Contents

require 'test_helper'

class RailsUtilTest < ActiveSupport::TestCase
  def setup_mock url
    @controller = Class.new do
      def self.helper      dummy   ; end
      def self.rescue_from dummy, _; end
      include RestCore::Facebook::RailsUtil
    end.new
    mock(@controller).rc_facebook_in_canvas?{ false }
    mock(@controller).request{ mock.url{ url }.object }
  end

  def test_rest_graph_normalized_request_uri_0
    setup_mock(  'http://test.com/?code=123&lang=en')
    assert_equal('http://test.com/?lang=en',
      @controller.send(:rc_facebook_normalized_request_uri))
  end

  def test_rest_graph_normalized_request_uri_1
    setup_mock(  'http://test.com/?lang=en&code=123')
    assert_equal('http://test.com/?lang=en',
      @controller.send(:rc_facebook_normalized_request_uri))
  end

  def test_rest_graph_normalized_request_uri_2
    setup_mock(  'http://test.com/?session=abc&lang=en&code=123')
    assert_equal('http://test.com/?lang=en',
      @controller.send(:rc_facebook_normalized_request_uri))
  end

  def test_rest_graph_normalized_request_uri_3
    setup_mock(  'http://test.com/?code=123')
    assert_equal('http://test.com/',
      @controller.send(:rc_facebook_normalized_request_uri))
  end

  def test_rest_graph_normalized_request_uri_4
    setup_mock(  'http://test.com/?signed_request=abc&code=123')
    assert_equal('http://test.com/',
      @controller.send(:rc_facebook_normalized_request_uri))
  end

  def test_config
    klass = RC::Builder.client
    RC::RailsUtilUtil.load_config(klass, 'macebook')

    assert_equal 41829           , klass.default_app_id
    assert_equal 'r41829'.reverse, klass.default_secret
    assert_equal false           , klass.default_json_response
    assert_equal 'zh-tw'         , klass.default_lang
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rest-more-3.4.0 example/rails3/test/unit/rails_util_test.rb
rest-more-3.3.4 example/rails3/test/unit/rails_util_test.rb
rest-more-3.3.3 example/rails3/test/unit/rails_util_test.rb
rest-more-3.3.2 example/rails3/test/unit/rails_util_test.rb
rest-more-3.3.1 example/rails3/test/unit/rails_util_test.rb
rest-more-3.3.0 example/rails3/test/unit/rails_util_test.rb
rest-more-3.2.0 example/rails3/test/unit/rails_util_test.rb
rest-more-3.1.0 example/rails3/test/unit/rails_util_test.rb