spree_api 2.0.10 → 2.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa047ba09ae648902132c95077e64faad8eb1f63
4
- data.tar.gz: e2fcbef05544ad3fd2f65f79fca38f175365800e
3
+ metadata.gz: 987159d621ff7cfdfcdc8fa4db6738e78bb4e4a2
4
+ data.tar.gz: 44a7a0ec5aff3f2f2b0cbf3a978e47ebe612f742
5
5
  SHA512:
6
- metadata.gz: 936aed8b8100f9f0e754109c74851a632abd2614e3c9a5951edf06aa782e7b00424bbebcb5665f45992a6295b66337dce4c64cc889e657d82656c2ac0a61ac21
7
- data.tar.gz: f4af5a1402eebf511cb0911d26ff65877708f721682cc1e01452e7fb20cbe81ecb0f4e34741dfafa1c3ca35abe2ffc7f8281abcb27d69b59921c27d3faa989f4
6
+ metadata.gz: c3aebbf513040a6f75ab4f4d76b2d5c35adf90ad1e44b9bc1d37b1103343945ea036fab9465e9874bdcd258d7d93d5e443d4dfd7f37443594382b4684b0b5cb9
7
+ data.tar.gz: 3af0f7bfb8acc3d11734ac2123216840f1cd733b3207c4152926e62f9274819e774c56afeffa64fc64d8f7a7164aecce1f85f57a8df6904914f9bbe74c51370e
@@ -64,8 +64,9 @@ Spree::Order.class_eval do
64
64
  shipment.save!
65
65
 
66
66
  shipping_method = Spree::ShippingMethod.find_by_name!(s[:shipping_method])
67
- shipment.shipping_rates.create!(:shipping_method => shipping_method,
68
- :cost => s[:cost])
67
+ rate = shipment.shipping_rates.create!(:shipping_method => shipping_method,
68
+ :cost => s[:cost])
69
+ shipment.selected_shipping_rate_id = rate.id
69
70
  rescue Exception => e
70
71
  raise "Order import shipments: #{e.message} #{s}"
71
72
  end
@@ -231,8 +231,20 @@ module Spree
231
231
  shipment = order.shipments.first
232
232
  shipment.inventory_units.first.variant_id.should eq product.master.id
233
233
  shipment.tracking.should eq '123456789'
234
- shipment.shipping_rates.first.cost.should eq 4.99
235
- shipment.stock_location.should eq stock_location
234
+ rate = shipment.selected_shipping_rate
235
+ rate.shipping_method.name.should == shipping_method.name
236
+ rate.cost.should == 4.99
237
+ end
238
+
239
+ it 'handles shipment building exceptions' do
240
+ params = { :shipments_attributes => [{ :tracking => '123456789',
241
+ :cost => '4.99',
242
+ :shipping_method => 'XXX',
243
+ :inventory_units => [{ :sku => sku }]
244
+ }] }
245
+ expect {
246
+ order = Order.build_from_api(user, params)
247
+ }.to raise_error /XXX/
236
248
  end
237
249
 
238
250
  it "raises if cant find stock location" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.10
4
+ version: 2.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-25 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.10
19
+ version: 2.0.11
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.10
26
+ version: 2.0.11
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rabl
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
246
  version: '0'
247
247
  requirements: []
248
248
  rubyforge_project:
249
- rubygems_version: 2.2.2
249
+ rubygems_version: 2.2.0
250
250
  signing_key:
251
251
  specification_version: 4
252
252
  summary: Spree's API