Sha256: ad57dcf7d365118e7e964262db0101f963dab396f3aa32f6e6827c8c3c502932
Contents?: true
Size: 1.82 KB
Versions: 11
Compression:
Stored size: 1.82 KB
Contents
require File.join(File.dirname(__FILE__), "test_helper") class TestFakeWebQueryString < Test::Unit::TestCase def setup FakeWeb.clean_registry end def test_register_uri_string_with_query_params FakeWeb.register_uri('http://example.com/?a=1&b=1', :string => 'foo') assert FakeWeb.registered_uri?('http://example.com/?a=1&b=1') FakeWeb.register_uri(URI.parse("http://example.org/?a=1&b=1"), :string => "foo") assert FakeWeb.registered_uri?("http://example.org/?a=1&b=1") end def test_register_uri_with_query_params_and_check_in_different_order FakeWeb.register_uri('http://example.com/?a=1&b=1', :string => 'foo') assert FakeWeb.registered_uri?('http://example.com/?b=1&a=1') FakeWeb.register_uri(URI.parse('http://example.org/?a=1&b=1'), :string => 'foo') assert FakeWeb.registered_uri?('http://example.org/?b=1&a=1') end def test_registered_uri_gets_recognized_with_empty_query_params FakeWeb.register_uri('http://example.com/', :string => 'foo') assert FakeWeb.registered_uri?('http://example.com/?') FakeWeb.register_uri(URI.parse('http://example.org/'), :string => 'foo') assert FakeWeb.registered_uri?('http://example.org/?') end def test_register_uri_with_empty_query_params_and_check_with_none FakeWeb.register_uri('http://example.com/?', :string => 'foo') assert FakeWeb.registered_uri?('http://example.com/') FakeWeb.register_uri(URI.parse('http://example.org/?'), :string => 'foo') assert FakeWeb.registered_uri?('http://example.org/') end def test_registry_sort_query_params assert_equal "a=1&b=2", FakeWeb::Registry.instance.send(:sort_query_params, "b=2&a=1") end def test_registry_sort_query_params_sorts_by_value_if_keys_collide assert_equal "a=1&a=2&b=2", FakeWeb::Registry.instance.send(:sort_query_params, "a=2&b=2&a=1") end end
Version data entries
11 entries across 11 versions & 4 rubygems