Sha256: 901a978293e87181ef6e225b5ac2ae8c26e583d9f859827d3fe74e072a50eeca

Contents?: true

Size: 745 Bytes

Versions: 10

Compression:

Stored size: 745 Bytes

Contents

require 'rspec'
require 'hyperion/requestor'
require 'hyperion_test'

describe 'fake_route' do
  include Hyperion::Requestor

  context 'for multipart form data as a part of the body' do
    let(:uri) { File.join('http://test.com', 'convert') }
    let(:response_descriptor) { ResponseDescriptor.new('converted_sample', 1, :json) }
    let(:route) { RestRoute.new(:post, uri, response_descriptor) }
    let(:response) { {'x' => 1} }

    it 'it fakes the given response' do
      fake_route(route, JSON.dump(response))
      expect(make_request(route)).to eql response
    end

    def make_request(route)
      body = Multipart.new(file: File.open(File.expand_path('spec/fixtures/test'), 'r'))
      request(route, body: body)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hyperion_http-0.6.0 spec/lib/hyperion_test/fake_route_spec.rb
hyperion_http-0.5.0 spec/lib/hyperion_test/fake_route_spec.rb
hyperion_http-0.3.0 spec/lib/hyperion_test/fake_route_spec.rb
hyperion_http-0.2.4 spec/lib/hyperion_test/fake_route_spec.rb
hyperion_http-0.2.3 spec/lib/hyperion_test/fake_route_spec.rb
hyperion_http-0.2.2 spec/lib/hyperion_test/fake_route_spec.rb
hyperion_http-0.2.1 spec/lib/hyperion_test/fake_route_spec.rb
hyperion_http-0.1.9 spec/lib/hyperion_test/fake_route_spec.rb
hyperion_http-0.1.8 spec/lib/hyperion_test/fake_route_spec.rb
hyperion_http-0.1.7 spec/lib/hyperion_test/fake_route_spec.rb