Sha256: 71e41ae545c47e8efe146a65d2aa63424bb56eebadf5cd5eabb5cb1a5ef4307a

Contents?: true

Size: 829 Bytes

Versions: 44

Compression:

Stored size: 829 Bytes

Contents

require 'rails_helper'

describe LHC::Request do
  it 'compiles url in case of configured endpoints' do
    options = { params: {
      has_reviews: true
    } }
    url = 'http://datastore/v2/campaign/:campaign_id/feedbacks'
    LHC.configure { |c| c.endpoint(:feedbacks, url, options) }
    stub_request(:get, 'http://datastore/v2/campaign/123/feedbacks?has_reviews=true')
    LHC.get(:feedbacks, params: { campaign_id: 123 })
  end

  it 'compiles url when doing a request' do
    stub_request(:get, 'http://datastore:8080/v2/feedbacks/123')
    LHC.get('http://datastore:8080/v2/feedbacks/:id', params: { id: 123 })
  end

  it 'considers body when compiling urls' do
    stub_request(:post, "http://datastore:8080/v2/places/123")
    LHC.json.post('http://datastore:8080/v2/places/:id', body: { id: 123 }.to_json)
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
lhc-6.7.2 spec/request/url_patterns_spec.rb
lhc-6.7.1 spec/request/url_patterns_spec.rb
lhc-6.7.0 spec/request/url_patterns_spec.rb
lhc-6.6.0.zipkin.pre.03 spec/request/url_patterns_spec.rb
lhc-6.6.0.zipkin.pre.02 spec/request/url_patterns_spec.rb
lhc-6.6.0.zipkin.pre.01 spec/request/url_patterns_spec.rb
lhc-6.6.0.zipkin.pre spec/request/url_patterns_spec.rb
lhc-6.6.0 spec/request/url_patterns_spec.rb
lhc-6.5.0 spec/request/url_patterns_spec.rb
lhc-6.4.0 spec/request/url_patterns_spec.rb
lhc-6.3.1 spec/request/url_patterns_spec.rb
lhc-6.3.0 spec/request/url_patterns_spec.rb
lhc-6.2.0 spec/request/url_patterns_spec.rb
lhc-6.1.3 spec/request/url_patterns_spec.rb
lhc-6.1.2 spec/request/url_patterns_spec.rb
lhc-6.1.1 spec/request/url_patterns_spec.rb
lhc-6.1.0 spec/request/url_patterns_spec.rb
lhc-6.0.1 spec/request/url_patterns_spec.rb
lhc-6.0.0 spec/request/url_patterns_spec.rb
lhc-5.1.1 spec/request/url_patterns_spec.rb