Sha256: 313d89ad7cc290c2625a2a8ec5bc453bf25600446a4f8fb42e4d3bed1aa47ce7
Contents?: true
Size: 1.64 KB
Versions: 8
Compression:
Stored size: 1.64 KB
Contents
require "spec_helper" describe FastshopCatalog::OrderStatusService do include Savon::SpecHelper before(:all) { savon.mock! } after(:all) { savon.unmock! } let(:contract_number) do "1234567890" end let(:order_number) do "3353496" end let(:partner_order_number) do "12121" end let(:service) do service = FastshopCatalog::OrderStatusService.new end let(:fixture) do File.read("spec/fixtures/order_status_service_successful_response.xml") end let(:sku) do 'IVIEP314RED' end let(:fixture_order_not_found) do File.read("spec/fixtures/order_status_service_order_not_found_response.xml") end describe "check" do it "should return the list with the order items" do savon.expects(:retorna_dados).with(:message => {'tns:contrato' => contract_number, 'tns:numeroPedidoFast' => order_number, 'tns:numeroPedidoParceiro' => partner_order_number}).returns(fixture) result = service.check(contract_number, order_number, partner_order_number) expect(result.length).to eq(1) expect(result.first['Sku']).to eq(sku) end it "should return raise order not found" do savon.expects(:retorna_dados).with(:message => {'tns:contrato' => contract_number, 'tns:numeroPedidoFast' => 1111, 'tns:numeroPedidoParceiro' => partner_order_number}).returns(fixture_order_not_found) expect do service.check(contract_number, 1111, partner_order_number) end.to raise_error(FastshopCatalog::ServiceException) do |e| expect(e.code).to eq(21) expect(e.description).to eq('Pedido nao encontrado') end end end end
Version data entries
8 entries across 8 versions & 1 rubygems