Sha256: 44fdc032096de7506f3913db85e8851fcfd37fe00c8f43cb7e6d7f2e9d469284
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
# encoding: UTF-8 require 'spec_helper' describe Correios::Frete::PacoteItem do describe ".new" do context "creates with default value of" do before(:each) { @item = Correios::Frete::PacoteItem.new } { :peso => 0.0, :comprimento => 0.0, :largura => 0.0, :altura => 0.0 }.each do |attr, value| it attr do expect(@item.send(attr)).to eq(value) end end end { :peso => 0.3, :comprimento => 30, :largura => 15, :altura => 2, }.each do |attr, value| context "when #{attr} is supplied" do it "sets #{attr}" do item = Correios::Frete::PacoteItem.new(attr => value) expect(item.send(attr)).to eq(value) end end context "when #{attr} is supplied in a block" do it "sets #{attr}" do item = Correios::Frete::PacoteItem.new { |f| f.send("#{attr}=", value) } expect(item.send(attr)).to eq(value) end end end end describe "#volume" do it "calculates item volume" do item = Correios::Frete::PacoteItem.new(:comprimento => 16, :largura => 11, :altura => 2) expect(item.volume).to eq(16 * 11 * 2) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
correios-frete-1.9.2 | spec/correios/frete/pacote_item_spec.rb |
correios-frete-1.9.1 | spec/correios/frete/pacote_item_spec.rb |