spree_api 3.0.0.rc1 → 3.0.0.rc3

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: 918a64814abd45ead2005fbface150d6703b4038
4
- data.tar.gz: b51dc9c832ad061af1e1b7d54095df7ad9648471
3
+ metadata.gz: ce116e8fb4a30f1ccbe401442ea8f6d467b664ad
4
+ data.tar.gz: f3eb5f31fafbc8481803e6054228fda895d9d747
5
5
  SHA512:
6
- metadata.gz: c2bcc152d0e4d1db8f0c60c706d53c35192c5875ddef8d4c5dbb24ee1b35fbe6a4a0b0943d4addb35f71c2d46df492705ff61f1c60fe943f3e20681b4dcfa4b5
7
- data.tar.gz: e2385d91a7c65706135ea244d3920fa0ede5a6f60204a5f9e1072a2468f756ef6f4ca841e959a040aa222afd57029a27bd01f06d1a6a0969b3c92dd76a7508aa
6
+ metadata.gz: 235a1081a4cb779a5e78879937479474f14630355b3c080b404a79ea0958e3f137d02a7f9cfee2aa6e8b6863e76f0beaf3727d41b150967e637e227bbdcebef0
7
+ data.tar.gz: 537fe799160cebcd7bb91609e57f7e547bcc19b2be169264156247b2b5e0f8d62318bf6f4a9a5c6064d29d5c40aa6cc0f1f88c790f9797d24eda3ba544edac16
@@ -35,7 +35,7 @@ module Spree
35
35
 
36
36
  return if after_update_attributes
37
37
 
38
- if @order.next || @order.completed?
38
+ if @order.completed? || @order.next
39
39
  state_callback(:after)
40
40
  respond_with(@order, default_template: 'spree/api/orders/show')
41
41
  else
@@ -9,12 +9,11 @@ module Spree
9
9
  let(:variant) { create(:variant) }
10
10
  let(:line_item) { create(:line_item) }
11
11
 
12
- let(:attributes) { [:number, :item_total, :display_total, :total,
13
- :state, :adjustment_total,
14
- :user_id, :created_at, :updated_at,
15
- :completed_at, :payment_total, :shipment_state,
16
- :payment_state, :email, :special_instructions,
17
- :total_quantity, :display_item_total, :currency] }
12
+ let(:attributes) do
13
+ [:number, :item_total, :display_total, :total, :state, :adjustment_total, :user_id,
14
+ :created_at, :updated_at, :completed_at, :payment_total, :shipment_state, :payment_state,
15
+ :email, :special_instructions, :total_quantity, :display_item_total, :currency]
16
+ end
18
17
 
19
18
  let(:address_params) { { :country_id => Country.first.id, :state_id => State.first.id } }
20
19
 
@@ -230,7 +229,7 @@ module Spree
230
229
  end
231
230
 
232
231
  it "can create an order" do
233
- api_post :create, :order => { :line_items => { "0" => { :variant_id => variant.to_param, :quantity => 5 } } }
232
+ api_post :create, order: { line_items: [{ variant_id: variant.to_param, quantity: 5 }] }
234
233
  expect(response.status).to eq(201)
235
234
 
236
235
  order = Order.last
@@ -260,23 +259,15 @@ module Spree
260
259
  expect(line_item).to receive(:update_attributes!).with("special" => true)
261
260
 
262
261
  allow(controller).to receive_messages(permitted_line_item_attributes: [:id, :variant_id, :quantity, :special])
263
- api_post :create, :order => {
264
- :line_items => {
265
- "0" => {
266
- :variant_id => variant.to_param, :quantity => 5, :special => true
267
- }
268
- }
262
+ api_post :create, order: {
263
+ line_items: [{ variant_id: variant.to_param, quantity: 5, special: true }]
269
264
  }
270
265
  expect(response.status).to eq(201)
271
266
  end
272
267
 
273
268
  it "cannot arbitrarily set the line items price" do
274
- api_post :create, :order => {
275
- :line_items => {
276
- "0" => {
277
- :price => 33.0, :variant_id => variant.to_param, :quantity => 5
278
- }
279
- }
269
+ api_post :create, order: {
270
+ line_items: [{ price: 33.0, variant_id: variant.to_param, quantity: 5 }]
280
271
  }
281
272
 
282
273
  expect(response.status).to eq 201
@@ -302,13 +293,7 @@ module Spree
302
293
  allow(order).to receive(:associate_user!)
303
294
  allow(order).to receive_message_chain(:contents, :add).and_return(line_item = double('LineItem'))
304
295
  expect(line_item).not_to receive(:update_attributes)
305
- api_post :create, :order => {
306
- :line_items => {
307
- "0" => {
308
- :variant_id => variant.to_param, :quantity => 5
309
- }
310
- }
311
- }
296
+ api_post :create, order: { line_items: [{ variant_id: variant.to_param, quantity: 5 }] }
312
297
  end
313
298
 
314
299
  it "can create an order without any parameters" do
@@ -683,12 +668,8 @@ module Spree
683
668
  end
684
669
 
685
670
  it "can arbitrarily set the line items price" do
686
- api_post :create, :order => {
687
- :line_items => {
688
- "0" => {
689
- :price => 33.0, :variant_id => variant.to_param, :quantity => 5
690
- }
691
- }
671
+ api_post :create, order: {
672
+ line_items: [{ price: 33.0, variant_id: variant.to_param, quantity: 5 }]
692
673
  }
693
674
  expect(response.status).to eq 201
694
675
  expect(Order.last.line_items.first.price.to_f).to eq(33.0)
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: 3.0.0.rc1
4
+ version: 3.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-04 00:00:00.000000000 Z
11
+ date: 2015-02-23 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: 3.0.0.rc1
19
+ version: 3.0.0.rc3
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: 3.0.0.rc1
26
+ version: 3.0.0.rc3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rabl
29
29
  requirement: !ruby/object:Gem::Requirement