Sha256: aff1ec7118c49257827fa51881c4acd716adb114a3d85561dfcd04230b234342

Contents?: true

Size: 875 Bytes

Versions: 2

Compression:

Stored size: 875 Bytes

Contents

require 'spec_helper'

describe SimpleShipping::Fedex::ShipmentBuilder do
  it_should_behave_like "builders"

  def build_it(opts = {})
    shipment = SimpleShipping::Shipment.new
    shipment.stub!(:valid? => true)
    SimpleShipping::Fedex::ShipmentBuilder.build(shipment, opts)
  end

  describe 'validation' do
    it 'validates inclusion of :dropoff_type' do
      lambda { build_it(:dropoff_type => :bad_value) }.should raise_error SimpleShipping::ValidationError
      lambda { build_it(:dropoff_type => :drop_box) }.should_not raise_error SimpleShipping::ValidationError
    end

    it 'validates inclusion of :service_type' do
      lambda { build_it(:service_type => :bad_value) }.should raise_error SimpleShipping::ValidationError
      lambda { build_it(:service_type => :fedex_ground ) }.should_not raise_error SimpleShipping::ValidationError
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_shipping-0.4.7 spec/lib/simple_shipping/fedex/shipment_builder_spec.rb
simple_shipping-0.4.6 spec/lib/simple_shipping/fedex/shipment_builder_spec.rb