Sha256: 2d8a47614bb0f5077a01752322a9d48ea3fda9f846cbd1e7f6c4e175b9d42140

Contents?: true

Size: 600 Bytes

Versions: 8

Compression:

Stored size: 600 Bytes

Contents

require 'rails_helper'

describe LHS::Record do
  before do
    class Record < LHS::Record
      endpoint 'http://datastore/records/'
    end
  end

  context 'fetch' do
    let!(:request_stub) do
      stub_request(:get, "http://datastore/records/?available=true&color=blue&range=%3E26")
        .to_return(body: [{
          name: 'Steve'
        }].to_json)
    end

    it 'resolves chains' do
      records = Record.where(color: 'blue').where(range: '>26', available: true).fetch
      expect(request_stub).to have_been_requested
      expect(records.first.name).to eq 'Steve'
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lhs-15.5.1 spec/record/fetch_spec.rb
lhs-15.5.0 spec/record/fetch_spec.rb
lhs-15.4.1 spec/record/fetch_spec.rb
lhs-15.4.0 spec/record/fetch_spec.rb
lhs-15.4.0.pre.hasone.1 spec/record/fetch_spec.rb
lhs-15.3.3 spec/record/fetch_spec.rb
lhs-15.3.3.pre.fixoptions.1 spec/record/fetch_spec.rb
lhs-15.3.2 spec/record/fetch_spec.rb