Sha256: 669bce87fc85ab6fb79b39dc49c767042d2d8aee1599e8ca120107c18cea41ce

Contents?: true

Size: 709 Bytes

Versions: 4

Compression:

Stored size: 709 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "Item" do
  
  let(:xml)         { File.open(File.expand_path(File.dirname(__FILE__) + '/../support/return.xml')).read }
  let(:transaction) { PagseguroCatcher::Transaction::Base.new(xml) }
  let(:item)        { PagseguroCatcher::Transaction::Item.new(transaction[:items][:item].first) }
  
  describe ".initialize" do
    it "assigns the body" do
      item.body.should be_a(Hash)
    end
  end
  
  describe "#amount" do
    it "returns the amount as a float" do
      item.amount.should == 24300.00
    end
  end
      
  describe "#id" do
    it "returns the item id as integer" do
      item.id.should == 1
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pagseguro_catcher-0.1.3 spec/transaction/item_spec.rb
pagseguro_catcher-0.1.2 spec/transaction/item_spec.rb
pagseguro_catcher-0.1.1 spec/transaction/item_spec.rb
pagseguro_catcher-0.1.0 spec/transaction/item_spec.rb