Sha256: 92f5d1ec295a530f94071abf36d9bcaa3eda37d2f4689a0fcba95b09b292ebdd

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))

with_rackup('basic.ru') do
  Shindo.tests('Excon basics') do
    tests('GET /content-length/100') do

      connection = Excon.new('http://127.0.0.1:9292')
      response = connection.request(:method => :get, :path => '/content-length/100')

      tests('response.status').returns(200) do
        response.status
      end

      tests("response.headers['Connection']").returns('Keep-Alive') do
        response.headers['Connection']
      end

      tests("response.headers['Content-Length']").returns('100') do
        response.headers['Content-Length']
      end

      tests("response.headers['Content-Type']").returns('text/html;charset=utf-8') do
        response.headers['Content-Type']
      end

      test("Time.parse(response.headers['Date']).is_a?(Time)") do
        Time.parse(response.headers['Date']).is_a?(Time)
      end

      test("!!(response.headers['Server'] =~ /^WEBrick/)") do
        !!(response.headers['Server'] =~ /^WEBrick/)
      end

      tests("response.headers['Custom']").returns("Foo: bar") do
        response.headers['Custom']
      end

      tests("response.body").returns('x' * 100) do
        response.body
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
excon-0.6.0 tests/basic_tests.rb
excon-0.5.8 tests/basic_tests.rb
excon-0.5.7 tests/basic_tests.rb