Sha256: e0df95ca1f2238ab7085f7ba8cf70f915050626a0bfa3e4f1ed5dd4082c36852

Contents?: true

Size: 729 Bytes

Versions: 120

Compression:

Stored size: 729 Bytes

Contents

require 'rails_helper'

describe LHS::Record do
  context 'set options for an endpoint' do
    before(:each) do
      class Record < LHS::Record
        endpoint 'backend/v2/feedbacks/:id', cache_expires_in: 1.day, retry: 2, cache: true
      end
    end

    it 'stores endpoints with options' do
      expect(Record.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)
      Record.find(1)
    end
  end
end

Version data entries

120 entries across 120 versions & 1 rubygems

Version Path
lhs-14.3.2 spec/record/endpoint_options_spec.rb
lhs-14.3.1 spec/record/endpoint_options_spec.rb
lhs-14.3.0 spec/record/endpoint_options_spec.rb
lhs-14.2.0 spec/record/endpoint_options_spec.rb
lhs-14.1.1 spec/record/endpoint_options_spec.rb
lhs-14.1.0 spec/record/endpoint_options_spec.rb
lhs-14.0.3 spec/record/endpoint_options_spec.rb
lhs-14.0.2 spec/record/endpoint_options_spec.rb
lhs-14.0.1 spec/record/endpoint_options_spec.rb
lhs-14.0.0 spec/record/endpoint_options_spec.rb
lhs-13.2.3 spec/record/endpoint_options_spec.rb
lhs-13.2.2 spec/record/endpoint_options_spec.rb
lhs-13.2.1 spec/record/endpoint_options_spec.rb
lhs-13.2.0 spec/record/endpoint_options_spec.rb
lhs-13.1.0 spec/record/endpoint_options_spec.rb
lhs-13.0.1 spec/record/endpoint_options_spec.rb
lhs-13.0.0 spec/record/endpoint_options_spec.rb
lhs-12.3.0 spec/record/endpoint_options_spec.rb
lhs-12.2.1 spec/record/endpoint_options_spec.rb
lhs-12.2.0 spec/record/endpoint_options_spec.rb