Sha256: 2969193ff8999a342eb6cd84be344667c715687d87fe9c4214c5baccb52e21ec
Contents?: true
Size: 981 Bytes
Versions: 5
Compression:
Stored size: 981 Bytes
Contents
require 'spec_helper' describe Seko::Receipt do let(:line_items_array) do [ { id: 1, upc: 100083, quantity: 10 }, { id: 2, upc: 100076, quantity: 15 } ] end before do Seko.configure(configuration) end describe '.line_items' do it 'structures line items into JSON ready hash' do expected_result = fixture(:receipt_submit)["Request"]["List"]["ReceiptLineItem"] expect(Seko::Receipt.line_items(line_items_array)).to eq(expected_result) end end describe '.format' do it 'formats a fully formed JSON ready hash for receipt' do expected_result = fixture(:receipt_submit) expect(Seko::Receipt).to receive(:random_asn).and_return(123456) expect(Seko::Receipt.format(line_items_array, 'DC123')).to eq(expected_result) end end describe '.random_asn' do it 'generates a 10 digit random string' do expect(Seko::Receipt.random_asn).to satisfy { |value| value.size == 10 } end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
seko-0.0.5 | spec/lib/receipt_spec.rb |
seko-0.0.4 | spec/lib/receipt_spec.rb |
seko-0.0.3 | spec/lib/receipt_spec.rb |
seko-0.0.2 | spec/lib/receipt_spec.rb |
seko-0.0.1 | spec/lib/receipt_spec.rb |