Sha256: 609d138b0ceafeebea502025a9dc93174345f58a07457ae07bb410d67db98d99

Contents?: true

Size: 757 Bytes

Versions: 18

Compression:

Stored size: 757 Bytes

Contents

require 'rails_helper'

describe LHS::Service do

  context 'set options for an endpoint' do

    before(:each) do
      class SomeService < LHS::Service
        endpoint 'backend/v2/feedbacks/:id', cache_expires_in: 1.day, retry: 2, cache: true
      end
    end

    it 'stores endpoints with options' do
      expect(SomeService.instance.endpoints[0].options).to eq(cache_expires_in: 86400, retry: 2, cache: true)
    end

    it 'uses the options that are configured for an endpoint' do
      expect(LHC).to receive(:request).with(cache_expires_in: 1.day, retry: 2, cache: true, url: 'backend/v2/feedbacks/1').and_call_original
      stub_request(:get, "http://backend/v2/feedbacks/1").to_return(status: 200)
      SomeService.find(1)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
lhs-1.6.1 spec/service/endpoint_options_spec.rb
lhs-1.6.0 spec/service/endpoint_options_spec.rb
lhs-2.0.5 spec/service/endpoint_options_spec.rb
lhs-2.0.4 spec/service/endpoint_options_spec.rb
lhs-2.0.3 spec/service/endpoint_options_spec.rb
lhs-2.0.2 spec/service/endpoint_options_spec.rb
lhs-2.0.1 spec/service/endpoint_options_spec.rb
lhs-2.0.0 spec/service/endpoint_options_spec.rb
lhs-1.5.0 spec/service/endpoint_options_spec.rb
lhs-1.4.0 spec/service/endpoint_options_spec.rb
lhs-1.3.1 spec/service/endpoint_options_spec.rb
lhs-1.3.0 spec/service/endpoint_options_spec.rb
lhs-1.2.3 spec/service/endpoint_options_spec.rb
lhs-1.2.2 spec/service/endpoint_options_spec.rb
lhs-1.2.1 spec/service/endpoint_options_spec.rb
lhs-1.2.0 spec/service/endpoint_options_spec.rb
lhs-1.1.0 spec/service/endpoint_options_spec.rb
lhs-1.0.0 spec/service/endpoint_options_spec.rb