Sha256: 918dd8aece50cdc79d83d226fdfec1bde13e2683e4428b7df3f8c6e9769e0a4b

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

# encoding: utf-8
require "spec_helper"

describe FastshopCatalog::CheckAvailabilityService do

  include Savon::SpecHelper
  before(:all) { savon.mock! }
  after(:all)  { savon.unmock! }

  let(:order) do
    order = FastshopCatalog::Entity::Order.new
    order.contract_code = '1234567890'
    order.zip_code = '02029001'
    order.document = '73978898160'
    order.number = '1560'
    order.total_amount = "249.00"
    order_item = FastshopCatalog::Entity::OrderItem.new
    order_item.sku = 'SODPFC70A'
    order_item.quantity = 1
    order_item.price = "249.00"
    order.items = [order_item]
    order
  end

  let(:order_fixture) do
    {"tns:dadosPedido"=>{"fas:Cep"=>"02029001", "fas:Contrato"=>"1234567890", "fas:Cpf"=>"73978898160", "fas:Itens"=>[{"fas:PedidoItensEntity"=>{"fas:Quantidade"=>1, "fas:Sku"=>"SODPFC70A", "fas:ValorUnitario"=>"249.00"}}], "fas:Numero"=>"1560", "fas:ValorTotal"=>"249.00"}}
  end

  let(:fixture) do
    File.read("spec/fixtures/check_availability_successful_response.xml")
  end

  describe "check" do
    it "should check that the order is ok" do

      savon.expects(:retorna_dados).with(:message => order_fixture).returns(fixture)
      service = FastshopCatalog::CheckAvailabilityService.new
      result = service.check(order)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fastshop_catalog-0.0.8 spec/fastshop_catalog/check_availability_service_spec.rb
fastshop_catalog-0.0.7 spec/fastshop_catalog/check_availability_service_spec.rb
fastshop_catalog-0.0.6 spec/fastshop_catalog/check_availability_service_spec.rb