Sha256: d1aebccf3930cb285375de1a856c3ff743f5d72c5055752c6d4629e56a47cf0b

Contents?: true

Size: 805 Bytes

Versions: 7

Compression:

Stored size: 805 Bytes

Contents

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

Excon.mock!

request = {
  :host   => 'www.google.com',
  :method => 'GET',
  :path   => '/'
}
response = Excon::Response.new({
  :status   => 200,
  :headers  => { 'Content-Length' => '11' },
  :body     => 'Hello World'
})
Excon.mocks[request] = response

Shindo.tests do

  before do
    @connection = Excon.new('http://www.google.com')
    @response = @connection.request({
      :host   => 'www.google.com',
      :method => 'GET',
      :path   => '/'
    })
  end

  test("status => 200") do
    @response.status == 200
  end

  test("headers => { 'Content-Length' => '11' }") do
    @response.headers == { 'Content-Length' => '11' }
  end

  test("body => 'Hello World") do
    @response.body == 'Hello World'
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
excon-0.0.14 tests/mock_tests.rb
excon-0.0.13 tests/mock_tests.rb
excon-0.0.12 tests/mock_tests.rb
excon-0.0.11 tests/mock_tests.rb
excon-0.0.10 tests/mock_tests.rb
excon-0.0.8 tests/mock_tests.rb
excon-0.0.7 tests/mock_tests.rb