Sha256: dc0a3ce10eff60873575c4359194242025e0771f0b3a89530d1b75a8653bbb7a
Contents?: true
Size: 1.18 KB
Versions: 8
Compression:
Stored size: 1.18 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 @item.send(attr).should == 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) item.send(attr).should == 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) } item.send(attr).should == value end end end end describe "#volume" do it "calculates item volume" do item = Correios::Frete::PacoteItem.new(:comprimento => 16, :largura => 11, :altura => 2) item.volume.should == 16 * 11 * 2 end end end
Version data entries
8 entries across 8 versions & 1 rubygems