Sha256: 6dc625f580142bd83fc4a3781fd8e5d4ed7f36f45492ab0e16b8711591fa5c0f

Contents?: true

Size: 902 Bytes

Versions: 1

Compression:

Stored size: 902 Bytes

Contents

require 'spec_helper'

RSpec.describe Gman::Client do
  include_context 'grossman client'

  let(:customer_id) { 100_001 }
  let(:response) do
    VCR.use_cassette('contracts') do
      client.contracts(customer_id_eq: 100_001)
    end
  end
  subject { response }

  it 'should have a client response' do
    is_expected.not_to be_empty
  end
  it 'should have responded with an array of hashes' do
    is_expected
      .to satisfy { |h| h.is_a?(Array) && h.all? { |e| e.is_a?(Hash) } }
  end

  describe 'first contract' do
    subject { response.first }
    its(:keys) do
      is_expected.to include(
        :contract_id,
        :commodity_id,
        :customer_id,
        :contract_number,
        :contract_date,
        :contract_type,
        :quantity,
        :delivered_bushels,
        :price,
        :freight_adjustment,
        :from_date,
        :to_date
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gman_client-0.0.7 spec/lib/client_contracts_spec.rb