Sha256: c8ddb242d136447a0c966281e13ea40ad1b01f0d27a5d53becca87028d4250d3

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe SimpleShipping::Package do
  it { should be_kind_of SimpleShipping::Abstract::Model }

  describe 'attributes' do
    it { should have_attribute :length }
    it { should have_attribute :width }
    it { should have_attribute :height }
    it { should have_attribute :dimension_units }
    it { should have_attribute :weight }
    it { should have_attribute :weight_units }
    it { should have_attribute :packaging_type }
  end

  describe 'validations' do
    it { should validate_presence_of :length }
    it { should validate_presence_of :width }
    it { should validate_presence_of :height }
    it { should validate_presence_of :dimension_units }
    it { should validate_presence_of :weight }
    it { should validate_presence_of :weight_units }
    it { should validate_inclusion_of(:weight_units).in(:kg, :lb) }
    it { should validate_inclusion_of(:dimension_units).in(:cm, :in) }
    it { should validate_inclusion_of(:packaging_type).in(:envelope, :pak, :tube, :your, :box, :box_10kg, :box_25kg) }
  end

  describe 'default values' do
    it { should have_default_value(:in).for_attribute(:dimension_units) }
    it { should have_default_value(:lb).for_attribute(:weight_units) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_shipping-0.4.7 spec/lib/simple_shipping/package_spec.rb
simple_shipping-0.4.6 spec/lib/simple_shipping/package_spec.rb