Sha256: 5c08d0cebe7c7d381357b963e5ff042538731e54d845c8b2638d34198e9258fa

Contents?: true

Size: 1.64 KB

Versions: 10

Compression:

Stored size: 1.64 KB

Contents

Shindo.tests('Excon query string variants') do
  with_rackup('query_string.ru') do
    connection = Excon.new('http://127.0.0.1:9292')

    tests(":query => {:foo => 'bar'}") do

      response = connection.request(:method => :get, :path => '/query', :query => {:foo => 'bar'})
      query_string = response.body[7..-1] # query string sent

      tests("query string sent").returns('foo=bar') do
        query_string
      end

    end

    tests(":query => {:foo => nil}") do

      response = connection.request(:method => :get, :path => '/query', :query => {:foo => nil})
      query_string = response.body[7..-1] # query string sent

      tests("query string sent").returns('foo') do
        query_string
      end

    end

    tests(":query => {:foo => 'bar', :me => nil}") do

      response = connection.request(:method => :get, :path => '/query', :query => {:foo => 'bar', :me => nil})
      query_string = response.body[7..-1] # query string sent

      test("query string sent includes 'foo=bar'") do
        query_string.split('&').include?('foo=bar')
      end

      test("query string sent includes 'me'") do
        query_string.split('&').include?('me')
      end

    end

    tests(":query => {:foo => 'bar', :me => 'too'}") do

      response = connection.request(:method => :get, :path => '/query', :query => {:foo => 'bar', :me => 'too'})
      query_string = response.body[7..-1] # query string sent

      test("query string sent includes 'foo=bar'") do
        query_string.split('&').include?('foo=bar')
      end

      test("query string sent includes 'me=too'") do
        query_string.split('&').include?('me=too')
      end

    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
excon-0.30.0 tests/query_string_tests.rb
excon-0.29.0 tests/query_string_tests.rb
excon-0.28.0 tests/query_string_tests.rb
excon-0.27.6 tests/query_string_tests.rb
excon-0.27.5 tests/query_string_tests.rb
excon-0.27.4 tests/query_string_tests.rb
excon-0.27.3 tests/query_string_tests.rb
excon-0.27.2 tests/query_string_tests.rb
excon-0.27.1 tests/query_string_tests.rb
excon-0.27.0 tests/query_string_tests.rb