Sha256: a2a6315934649807432a46280494b76e64a53869e1866714509da3230c3243d8

Contents?: true

Size: 1.64 KB

Versions: 84

Compression:

Stored size: 1.64 KB

Contents

with_rackup('query_string.ru') do
  Shindo.tests('Excon query string variants') 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

84 entries across 84 versions & 3 rubygems

Version Path
excon-0.26.0 tests/query_string_tests.rb
excon-0.25.3 tests/query_string_tests.rb
excon-0.25.2 tests/query_string_tests.rb
excon-0.25.1 tests/query_string_tests.rb
excon-0.25.0 tests/query_string_tests.rb
excon-0.24.0 tests/query_string_tests.rb
excon-0.23.0 tests/query_string_tests.rb
excon-0.22.1 tests/query_string_tests.rb
excon-0.22.0 tests/query_string_tests.rb
vagrant-shell-0.2.6 vendor/bundle/gems/excon-0.20.1/tests/query_string_tests.rb
vagrant-shell-0.2.5 vendor/bundle/gems/excon-0.20.1/tests/query_string_tests.rb
excon-0.21.0 tests/query_string_tests.rb
excon-0.20.1 tests/query_string_tests.rb
excon-0.20.0 tests/query_string_tests.rb
excon-0.19.5 tests/query_string_tests.rb
excon-0.19.4 tests/query_string_tests.rb
excon-0.19.3 tests/query_string_tests.rb
excon-0.19.2 tests/query_string_tests.rb
excon-0.19.1 tests/query_string_tests.rb
excon-0.19.0 tests/query_string_tests.rb