Sha256: 9b7d179d3d2572a5bd4981588f7aa466ee478e8fbc4ec6468510bca5aeb7018e

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

require "spec_helper"

describe PagseguroClient::Order do
  
  it "should set order id when instantiating object" do
    order = PagseguroClient::Order.new("ABCDEF")
    order.id.should == "ABCDEF"
  end
  
  it "should add product" do
    order = PagseguroClient::Order.new("John Doe")
    order.add(id: "1", description: "Description", amount: 199)
    order.products.should_not be_empty
    order.products.size.should == 1
    order.products.first[:id].should == "1"
  end
  
  it "should set order product data" do
    order = PagseguroClient::Order.new("John Doe")
    order.add(id: "1", description: "Description", amount: 199)
    order.add(id: "2", description: "Description", amount: 199)
    order.add(id: "3", description: "Description", amount: 199)
    
    data = order.data
    data.keys.include?("itemId1").should be_true
    data.keys.include?("itemId2").should be_true
    data.keys.include?("itemId3").should be_true
    
    data["itemId1"].should == "1"
    data["itemId2"].should == "2"
    data["itemId3"].should == "3"
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pagseguro_client-0.0.1 spec/pagseguro_client/order_spec.rb