Sha256: 0e6e734faf16b9d67beb75a2f8c68eb00635c126386a5f545e2eacb698f77d6a

Contents?: true

Size: 697 Bytes

Versions: 8

Compression:

Stored size: 697 Bytes

Contents

require 'spec_helper'
require 'data-com-api/query_parameters'

describe WebMock do
  let!(:dummy_url) { 'http://dummyurl.com' }

  before do
    # Be careful, when stubbing, all values must be strings
    stub_request(
      :get,
      dummy_url
    ).with(
      query: hash_including(DataComApi::QueryParameters.stringify_hash_values({
        param1: 5,
        param2: 'random1'
      }))
    ).to_return(
      body: 'body 1'
    )
  end

  it "receive a request when mocked with query param" do
    expect(
      HTTParty.get(dummy_url, {
        query: {
          param1: 5,
          param2: 'random1',
          param3: 'random3'
        }
      }).body
    ).to eq 'body 1'
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
data-com-api-0.2.1 spec/integration/webmock_spec.rb
data-com-api-0.2.0 spec/integration/webmock_spec.rb
data-com-api-0.1.5 spec/integration/webmock_spec.rb
data-com-api-0.1.4 spec/integration/webmock_spec.rb
data-com-api-0.1.3 spec/integration/webmock_spec.rb
data-com-api-0.1.2 spec/integration/webmock_spec.rb
data-com-api-0.1.1 spec/integration/webmock_spec.rb
data-com-api-0.1.0 spec/integration/webmock_spec.rb