Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (28 sloc) 1.277 kb
59d3654 Chris Kampmeier Refactor the new test/test_query_string.rb to use the test_helper
chrisk authored
1 require File.join(File.dirname(__FILE__), "test_helper")
3c857cc Mislav Marohnić extract query parameters related test to a separate test case
mislav authored
2
59d3654 Chris Kampmeier Refactor the new test/test_query_string.rb to use the test_helper
chrisk authored
3 class TestFakeWebQueryString < Test::Unit::TestCase
3c857cc Mislav Marohnić extract query parameters related test to a separate test case
mislav authored
4
5 def setup
6 FakeWeb.clean_registry
7 end
8
9 def test_register_uri_with_query_params
10 FakeWeb.register_uri('http://example.com/?a=1&b=1', :string => 'foo')
11 assert FakeWeb.registered_uri?('http://example.com/?a=1&b=1')
12 end
13
14 def test_register_uri_with_query_params_and_check_in_different_order
15 FakeWeb.register_uri('http://example.com/?a=1&b=1', :string => 'foo')
16 assert FakeWeb.registered_uri?('http://example.com/?b=1&a=1')
17 end
e7d0b21 Chris Kampmeier Also test that URIs with no query string match against registered URIs w...
chrisk authored
18
7227e91 Mislav Marohnić change that 'http://example.com/?' (empty query) gets normalized to 'htt...
mislav authored
19 def test_registered_uri_gets_recognized_with_empty_query_params
20 FakeWeb.register_uri('http://example.com/', :string => 'foo')
21 assert FakeWeb.registered_uri?('http://example.com/?')
22 end
3c857cc Mislav Marohnić extract query parameters related test to a separate test case
mislav authored
23
e7d0b21 Chris Kampmeier Also test that URIs with no query string match against registered URIs w...
chrisk authored
24 def test_register_uri_with_empty_query_params_and_check_with_none
25 FakeWeb.register_uri('http://example.com/?', :string => 'foo')
26 assert FakeWeb.registered_uri?('http://example.com/')
27 end
28
3c857cc Mislav Marohnić extract query parameters related test to a separate test case
mislav authored
29 def test_registry_sort_query_params
30 assert_equal "a=1&b=2", FakeWeb::Registry.instance.send(:sort_query_params, "b=2&a=1")
31 end
32
33 def test_registry_sort_query_params_sorts_by_value_if_keys_collide
34 assert_equal "a=1&a=2&b=2", FakeWeb::Registry.instance.send(:sort_query_params, "a=2&b=2&a=1")
35 end
59d3654 Chris Kampmeier Refactor the new test/test_query_string.rb to use the test_helper
chrisk authored
36
3c857cc Mislav Marohnić extract query parameters related test to a separate test case
mislav authored
37 end
Something went wrong with that request. Please try again.