Sha256: 56ffffb5422ea39c6a18e5a6d4711191a48f988d69caac281c003487014e98f1

Contents?: true

Size: 1.39 KB

Versions: 19

Compression:

Stored size: 1.39 KB

Contents

require 'test_helper'
require 'rr'

class RailsUtilTest < ActiveSupport::TestCase
  include RR::Adapters::TestUnit

  def setup_mock url
    mock(RestGraph::RailsUtil).rest_graph_in_canvas?{ false }
    mock(RestGraph::RailsUtil).request{
      mock(Object.new).url{ url }
    }
  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',
                 RestGraph::RailsUtil.rest_graph_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',
                 RestGraph::RailsUtil.rest_graph_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',
                 RestGraph::RailsUtil.rest_graph_normalized_request_uri)
  end

  def test_rest_graph_normalized_request_uri_3
    setup_mock(  'http://test.com/?code=123')
    assert_equal('http://test.com/',
                 RestGraph::RailsUtil.rest_graph_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/',
                 RestGraph::RailsUtil.rest_graph_normalized_request_uri)
  end
end

Version data entries

19 entries across 12 versions & 1 rubygems

Version Path
rest-graph-2.0.3 example/rails3/test/unit/rails_util_test.rb
rest-graph-2.0.3 example/rails2/test/unit/rails_util_test.rb
rest-graph-2.0.2 example/rails3/test/unit/rails_util_test.rb
rest-graph-2.0.2 example/rails2/test/unit/rails_util_test.rb
rest-graph-2.0.1 example/rails2/test/unit/rails_util_test.rb
rest-graph-2.0.1 example/rails3/test/unit/rails_util_test.rb
rest-graph-2.0.0 example/rails3/test/unit/rails_util_test.rb
rest-graph-2.0.0 example/rails2/test/unit/rails_util_test.rb
rest-graph-1.9.1 example/rails2/test/unit/rails_util_test.rb
rest-graph-1.9.1 example/rails3/test/unit/rails_util_test.rb
rest-graph-1.9.0 example/rails2/test/unit/rails_util_test.rb
rest-graph-1.9.0 example/rails3/test/unit/rails_util_test.rb
rest-graph-1.8.0 example/rails3/test/unit/rails_util_test.rb
rest-graph-1.8.0 example/rails2/test/unit/rails_util_test.rb
rest-graph-1.7.0 example/rails2/test/unit/rails_util_test.rb
rest-graph-1.6.0 example/rails2/test/unit/rails_util_test.rb
rest-graph-1.5.0 example/rails2/test/unit/rails_util_test.rb
rest-graph-1.4.6 example/rails/test/unit/rails_util_test.rb
rest-graph-1.4.5 example/rails/test/unit/rails_util_test.rb