spec/lib/fedex/shipment_spec.rb in fedex-3.1.0 vs spec/lib/fedex/shipment_spec.rb in fedex-3.3.0

- old
+ new

@@ -20,15 +20,16 @@ end let(:shipping_options) do { :packaging_type => "YOUR_PACKAGING", :drop_off_type => "REGULAR_PICKUP" } end + let(:filename) { + require 'tmpdir' + File.join(Dir.tmpdir, "label#{rand(15000)}.pdf") + } + context "domestic shipment", :vcr do - let(:filename) { - require 'tmpdir' - File.join(Dir.tmpdir, "label#{rand(15000)}.pdf") - } let(:options) do {:shipper => shipper, :recipient => recipient, :packages => packages, :service_type => "FEDEX_GROUND", :filename => filename} end it "succeeds" do @@ -36,9 +37,22 @@ @shipment = fedex.ship(options) }.to_not raise_error @shipment.class.should_not == Fedex::RateError end + end + + context 'without service_type specified', :vcr do + let(:options) do + {:shipper => shipper, :recipient => recipient, :packages => packages, :filename => filename} + end + + it 'raises error' do + expect { + @shipment = fedex.ship(options) + }.to raise_error('Missing Required Parameter service_type') + end + end end end