Sha256: 6487c790b7c150c8c53b267b6ee7406aad8c6f125d865dd90ce584063c3f8b8a

Contents?: true

Size: 1.72 KB

Versions: 31

Compression:

Stored size: 1.72 KB

Contents

Shindo.tests('Excon query string variants') do
  with_rackup('query_string.ru') do
    connection = nil

    tests(":query => {:foo => 'bar'}") do
      tests("query string sent").returns('foo=bar') do
        connection = Excon.new('http://127.0.0.1:9292')

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

        query_string
      end
    end

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

        query_string
      end
    end

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

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

        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
      query_string = nil

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

        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

31 entries across 31 versions & 2 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/excon-0.45.3/tests/query_string_tests.rb
excon-0.45.3 tests/query_string_tests.rb
excon-0.45.2 tests/query_string_tests.rb
excon-0.45.1 tests/query_string_tests.rb
excon-0.45.0 tests/query_string_tests.rb
excon-0.44.4 tests/query_string_tests.rb
excon-0.44.3 tests/query_string_tests.rb
excon-0.44.2 tests/query_string_tests.rb
excon-0.44.1 tests/query_string_tests.rb
excon-0.44.0 tests/query_string_tests.rb
excon-0.43.0 tests/query_string_tests.rb
excon-0.42.1 tests/query_string_tests.rb
excon-0.42.0 tests/query_string_tests.rb
excon-0.41.0 tests/query_string_tests.rb
excon-0.40.0 tests/query_string_tests.rb
excon-0.39.6 tests/query_string_tests.rb
excon-0.39.5 tests/query_string_tests.rb
excon-0.39.4 tests/query_string_tests.rb
excon-0.39.3 tests/query_string_tests.rb
excon-0.39.2 tests/query_string_tests.rb