Sha256: 7d7510c8f81285666fc5cf3ef85b41189f4363135643bd3a9406f38393f908f4

Contents?: true

Size: 859 Bytes

Versions: 76

Compression:

Stored size: 859 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe LHS::Record do
  let(:datastore) do
    'http://datastore/v2'
  end

  let(:response) do
    { body: [{ name: 'Steve' }] }
  end

  before do
    LHC.config.placeholder('datastore', datastore)
    class Record < LHS::Record
      endpoint '{+datastore}/records/'
    end
  end

  context 'where values hash' do
    it 'provides the hash or where parameters that have been requested' do
      stub_request(:get, "http://datastore/v2/records/?available=true&color=blue").to_return(response)
      expect(
        Record.where(available: true).where(color: 'blue').where_values_hash
      ).to eq(available: true, color: 'blue')
      expect(
        Record.where(available: true, color: 'red').where(color: 'blue').where_values_hash
      ).to eq(available: true, color: 'blue')
    end
  end
end

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
lhs-21.0.0 spec/record/where_values_hash_spec.rb
lhs-20.1.4 spec/record/where_values_hash_spec.rb
lhs-20.1.3.pre.paginationfix.3 spec/record/where_values_hash_spec.rb
lhs-20.1.3.pre.paginationfix.2 spec/record/where_values_hash_spec.rb
lhs-20.1.3.pre.paginationfix.1 spec/record/where_values_hash_spec.rb
lhs-20.1.2 spec/record/where_values_hash_spec.rb
lhs-20.1.1 spec/record/where_values_hash_spec.rb
lhs-20.0.0 spec/record/where_values_hash_spec.rb
lhs-19.10.0 spec/record/where_values_hash_spec.rb
lhs-19.9.0 spec/record/where_values_hash_spec.rb
lhs-19.8.2 spec/record/where_values_hash_spec.rb
lhs-19.8.1 spec/record/where_values_hash_spec.rb
lhs-19.8.0 spec/record/where_values_hash_spec.rb
lhs-19.7.0 spec/record/where_values_hash_spec.rb
lhs-19.6.0 spec/record/where_values_hash_spec.rb
lhs-19.5.0 spec/record/where_values_hash_spec.rb
lhs-19.5.0.pre.wherehref.1 spec/record/where_values_hash_spec.rb
lhs-19.4.1 spec/record/where_values_hash_spec.rb
lhs-19.4.0 spec/record/where_values_hash_spec.rb
lhs-19.3.1 spec/record/where_values_hash_spec.rb