spree_api 3.0.0.rc1 → 3.0.0.rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce116e8fb4a30f1ccbe401442ea8f6d467b664ad
|
4
|
+
data.tar.gz: f3eb5f31fafbc8481803e6054228fda895d9d747
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 235a1081a4cb779a5e78879937479474f14630355b3c080b404a79ea0958e3f137d02a7f9cfee2aa6e8b6863e76f0beaf3727d41b150967e637e227bbdcebef0
|
7
|
+
data.tar.gz: 537fe799160cebcd7bb91609e57f7e547bcc19b2be169264156247b2b5e0f8d62318bf6f4a9a5c6064d29d5c40aa6cc0f1f88c790f9797d24eda3ba544edac16
|
@@ -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)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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, :
|
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, :
|
264
|
-
:
|
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, :
|
275
|
-
:
|
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, :
|
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, :
|
687
|
-
:
|
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.
|
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-
|
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.
|
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.
|
26
|
+
version: 3.0.0.rc3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rabl
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|