spree_api 2.4.0.rc2 → 2.4.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/api/base_controller.rb +4 -6
- data/app/controllers/spree/api/option_types_controller.rb +2 -2
- data/app/controllers/spree/api/orders_controller.rb +9 -1
- data/app/controllers/spree/api/return_authorizations_controller.rb +0 -9
- data/app/controllers/spree/api/taxons_controller.rb +3 -3
- data/app/helpers/spree/api/api_helpers.rb +0 -2
- data/app/views/spree/api/orders/show.v1.rabl +4 -0
- data/app/views/spree/api/products/show.v1.rabl +4 -0
- data/app/views/spree/api/shipments/small.v1.rabl +4 -0
- data/lib/spree/api/testing_support/helpers.rb +6 -6
- data/lib/spree/api/testing_support/setup.rb +2 -2
- data/spec/controllers/spree/api/addresses_controller_spec.rb +8 -8
- data/spec/controllers/spree/api/base_controller_spec.rb +22 -22
- data/spec/controllers/spree/api/checkouts_controller_spec.rb +53 -53
- data/spec/controllers/spree/api/classifications_controller_spec.rb +5 -5
- data/spec/controllers/spree/api/config_controller_spec.rb +9 -9
- data/spec/controllers/spree/api/countries_controller_spec.rb +11 -11
- data/spec/controllers/spree/api/credit_cards_controller_spec.rb +16 -16
- data/spec/controllers/spree/api/images_controller_spec.rb +21 -21
- data/spec/controllers/spree/api/inventory_units_controller_spec.rb +6 -6
- data/spec/controllers/spree/api/line_items_controller_spec.rb +33 -33
- data/spec/controllers/spree/api/option_types_controller_spec.rb +19 -19
- data/spec/controllers/spree/api/option_values_controller_spec.rb +23 -23
- data/spec/controllers/spree/api/orders_controller_spec.rb +186 -143
- data/spec/controllers/spree/api/payments_controller_spec.rb +39 -39
- data/spec/controllers/spree/api/product_properties_controller_spec.rb +21 -21
- data/spec/controllers/spree/api/products_controller_spec.rb +71 -66
- data/spec/controllers/spree/api/promotion_application_spec.rb +13 -13
- data/spec/controllers/spree/api/promotions_controller_spec.rb +1 -1
- data/spec/controllers/spree/api/properties_controller_spec.rb +25 -25
- data/spec/controllers/spree/api/return_authorizations_controller_spec.rb +27 -36
- data/spec/controllers/spree/api/shipments_controller_spec.rb +22 -22
- data/spec/controllers/spree/api/states_controller_spec.rb +18 -18
- data/spec/controllers/spree/api/stock_items_controller_spec.rb +26 -26
- data/spec/controllers/spree/api/stock_locations_controller_spec.rb +22 -22
- data/spec/controllers/spree/api/stock_movements_controller_spec.rb +16 -16
- data/spec/controllers/spree/api/taxonomies_controller_spec.rb +24 -24
- data/spec/controllers/spree/api/taxons_controller_spec.rb +39 -39
- data/spec/controllers/spree/api/unauthenticated_products_controller_spec.rb +6 -6
- data/spec/controllers/spree/api/users_controller_spec.rb +25 -25
- data/spec/controllers/spree/api/variants_controller_spec.rb +36 -36
- data/spec/controllers/spree/api/zones_controller_spec.rb +20 -20
- data/spec/models/spree/legacy_user_spec.rb +5 -5
- data/spec/requests/rabl_cache_spec.rb +9 -9
- data/spec/spec_helper.rb +0 -1
- data/spec/support/controller_hacks.rb +4 -0
- metadata +4 -4
@@ -1,32 +1,32 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "Rabl Cache", :caching => true do
|
3
|
+
describe "Rabl Cache", :type => :request, :caching => true do
|
4
4
|
let!(:user) { create(:admin_user) }
|
5
5
|
|
6
6
|
before do
|
7
7
|
create(:variant)
|
8
8
|
user.generate_spree_api_key!
|
9
|
-
Spree::Product.count.
|
9
|
+
expect(Spree::Product.count).to eq(1)
|
10
10
|
end
|
11
11
|
|
12
12
|
it "doesn't create a cache key collision for models with different rabl templates" do
|
13
13
|
get "/api/variants", :token => user.spree_api_key
|
14
|
-
response.status.
|
14
|
+
expect(response.status).to eq(200)
|
15
15
|
|
16
16
|
# Make sure we get a non master variant
|
17
17
|
variant_a = JSON.parse(response.body)['variants'].select do |v|
|
18
18
|
!v['is_master']
|
19
19
|
end.first
|
20
20
|
|
21
|
-
variant_a['is_master'].
|
22
|
-
variant_a['stock_items'].
|
21
|
+
expect(variant_a['is_master']).to be false
|
22
|
+
expect(variant_a['stock_items']).not_to be_nil
|
23
23
|
|
24
24
|
get "/api/products/#{Spree::Product.first.id}", :token => user.spree_api_key
|
25
|
-
response.status.
|
25
|
+
expect(response.status).to eq(200)
|
26
26
|
variant_b = JSON.parse(response.body)['variants'].last
|
27
|
-
variant_b['is_master'].
|
27
|
+
expect(variant_b['is_master']).to be false
|
28
28
|
|
29
|
-
variant_a['id'].
|
30
|
-
variant_b['stock_items'].
|
29
|
+
expect(variant_a['id']).to eq(variant_b['id'])
|
30
|
+
expect(variant_b['stock_items']).to be_nil
|
31
31
|
end
|
32
32
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -12,6 +12,10 @@ module ControllerHacks
|
|
12
12
|
api_process(action, params, session, flash, "PUT")
|
13
13
|
end
|
14
14
|
|
15
|
+
def api_patch(action, params={}, session=nil, flash=nil)
|
16
|
+
api_process(action, params, session, flash, "PATCH")
|
17
|
+
end
|
18
|
+
|
15
19
|
def api_delete(action, params={}, session=nil, flash=nil)
|
16
20
|
api_process(action, params, session, flash, "DELETE")
|
17
21
|
end
|
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.4.0.
|
4
|
+
version: 2.4.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: 2014-
|
11
|
+
date: 2014-11-07 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.4.0.
|
19
|
+
version: 2.4.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: 2.4.0.
|
26
|
+
version: 2.4.0.rc3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rabl
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|