solidus_api 2.2.2 → 2.3.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_api might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/controllers/spree/api/images_controller.rb +2 -2
- data/app/controllers/spree/api/line_items_controller.rb +2 -10
- data/app/controllers/spree/api/orders_controller.rb +2 -12
- data/app/controllers/spree/api/payments_controller.rb +0 -1
- data/app/controllers/spree/api/promotions_controller.rb +1 -1
- data/app/controllers/spree/api/variants_controller.rb +2 -1
- data/app/views/spree/api/orders/show.v1.rabl +2 -1
- data/lib/spree/api/testing_support/setup.rb +1 -1
- data/spec/controllers/spree/api/base_controller_spec.rb +7 -7
- data/spec/controllers/spree/api/resource_controller_spec.rb +16 -16
- data/spec/requests/api/address_books_spec.rb +1 -1
- data/spec/{controllers → requests}/spree/api/addresses_controller_spec.rb +6 -9
- data/spec/{controllers → requests}/spree/api/checkouts_controller_spec.rb +38 -69
- data/spec/{controllers → requests}/spree/api/classifications_controller_spec.rb +4 -4
- data/spec/{controllers → requests}/spree/api/config_controller_spec.rb +3 -4
- data/spec/{controllers → requests}/spree/api/countries_controller_spec.rb +6 -7
- data/spec/{controllers → requests}/spree/api/credit_cards_controller_spec.rb +8 -9
- data/spec/{controllers → requests}/spree/api/images_controller_spec.rb +19 -16
- data/spec/{controllers → requests}/spree/api/inventory_units_controller_spec.rb +17 -14
- data/spec/{controllers → requests}/spree/api/line_items_controller_spec.rb +32 -32
- data/spec/{controllers → requests}/spree/api/option_types_controller_spec.rb +27 -27
- data/spec/{controllers → requests}/spree/api/option_values_controller_spec.rb +32 -29
- data/spec/{controllers → requests}/spree/api/orders_controller_spec.rb +103 -133
- data/spec/{controllers → requests}/spree/api/payments_controller_spec.rb +30 -44
- data/spec/{controllers → requests}/spree/api/product_properties_controller_spec.rb +15 -17
- data/spec/{controllers → requests}/spree/api/products_controller_spec.rb +44 -43
- data/spec/{controllers → requests}/spree/api/promotion_application_spec.rb +3 -4
- data/spec/{controllers → requests}/spree/api/promotions_controller_spec.rb +8 -6
- data/spec/{controllers → requests}/spree/api/properties_controller_spec.rb +15 -16
- data/spec/{controllers → requests}/spree/api/return_authorizations_controller_spec.rb +19 -21
- data/spec/requests/spree/api/shipments_controller_spec.rb +394 -88
- data/spec/{controllers → requests}/spree/api/states_controller_spec.rb +8 -9
- data/spec/{controllers → requests}/spree/api/stock_items_controller_spec.rb +21 -21
- data/spec/{controllers → requests}/spree/api/stock_locations_controller_spec.rb +18 -20
- data/spec/{controllers → requests}/spree/api/stock_movements_controller_spec.rb +9 -12
- data/spec/{controllers → requests}/spree/api/stock_transfers_controller_spec.rb +2 -3
- data/spec/requests/spree/api/store_credit_events_controller_spec.rb +57 -0
- data/spec/{controllers → requests}/spree/api/stores_controller_spec.rb +19 -20
- data/spec/{controllers → requests}/spree/api/taxonomies_controller_spec.rb +14 -15
- data/spec/{controllers → requests}/spree/api/taxons_controller_spec.rb +17 -18
- data/spec/{controllers → requests}/spree/api/transfer_items_controller_spec.rb +7 -9
- data/spec/{controllers → requests}/spree/api/unauthenticated_products_controller_spec.rb +2 -3
- data/spec/{controllers → requests}/spree/api/users_controller_spec.rb +18 -19
- data/spec/{controllers → requests}/spree/api/variants_controller_spec.rb +70 -37
- data/spec/{controllers → requests}/spree/api/zones_controller_spec.rb +13 -14
- data/spec/shared_examples/protect_product_actions.rb +3 -3
- data/spec/spec_helper.rb +4 -1
- metadata +70 -72
- data/spec/controllers/spree/api/shipments_controller_spec.rb +0 -301
- data/spec/controllers/spree/api/store_credit_events_controller_spec.rb +0 -66
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::Api::StoreCreditEventsController, type: :controller do
|
4
|
-
render_views
|
5
|
-
|
6
|
-
let(:api_user) { create(:user) }
|
7
|
-
|
8
|
-
before do
|
9
|
-
allow(controller).to receive(:load_user)
|
10
|
-
controller.instance_variable_set(:@current_api_user, api_user)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "GET mine" do
|
14
|
-
subject { api_get :mine, { format: :json } }
|
15
|
-
|
16
|
-
before { allow(controller).to receive_messages(current_api_user: current_api_user) }
|
17
|
-
|
18
|
-
context "no current api user" do
|
19
|
-
let(:current_api_user) { nil }
|
20
|
-
|
21
|
-
before { subject }
|
22
|
-
|
23
|
-
it "returns a 401" do
|
24
|
-
expect(response.status).to eq 401
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context "the current api user is authenticated" do
|
29
|
-
let(:current_api_user) { order.user }
|
30
|
-
let(:order) { create(:order, line_items: [line_item]) }
|
31
|
-
|
32
|
-
context "the user doesn't have store credit" do
|
33
|
-
let(:current_api_user) { create(:user) }
|
34
|
-
|
35
|
-
before { subject }
|
36
|
-
|
37
|
-
it "should set the events variable to empty list" do
|
38
|
-
expect(assigns(:store_credit_events)).to eq []
|
39
|
-
end
|
40
|
-
|
41
|
-
it "returns a 200" do
|
42
|
-
expect(subject.status).to eq 200
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context "the user has store credit" do
|
47
|
-
let(:store_credit) { create(:store_credit, user: api_user) }
|
48
|
-
let(:current_api_user) { store_credit.user }
|
49
|
-
|
50
|
-
before { subject }
|
51
|
-
|
52
|
-
it "should contain one store credit event" do
|
53
|
-
expect(assigns(:store_credit_events).size).to eq 1
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should contain the store credit allocation event" do
|
57
|
-
expect(assigns(:store_credit_events).first).to eq store_credit.store_credit_events.first
|
58
|
-
end
|
59
|
-
|
60
|
-
it "returns a 200" do
|
61
|
-
expect(subject.status).to eq 200
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|