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.

Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spree/api/images_controller.rb +2 -2
  3. data/app/controllers/spree/api/line_items_controller.rb +2 -10
  4. data/app/controllers/spree/api/orders_controller.rb +2 -12
  5. data/app/controllers/spree/api/payments_controller.rb +0 -1
  6. data/app/controllers/spree/api/promotions_controller.rb +1 -1
  7. data/app/controllers/spree/api/variants_controller.rb +2 -1
  8. data/app/views/spree/api/orders/show.v1.rabl +2 -1
  9. data/lib/spree/api/testing_support/setup.rb +1 -1
  10. data/spec/controllers/spree/api/base_controller_spec.rb +7 -7
  11. data/spec/controllers/spree/api/resource_controller_spec.rb +16 -16
  12. data/spec/requests/api/address_books_spec.rb +1 -1
  13. data/spec/{controllers → requests}/spree/api/addresses_controller_spec.rb +6 -9
  14. data/spec/{controllers → requests}/spree/api/checkouts_controller_spec.rb +38 -69
  15. data/spec/{controllers → requests}/spree/api/classifications_controller_spec.rb +4 -4
  16. data/spec/{controllers → requests}/spree/api/config_controller_spec.rb +3 -4
  17. data/spec/{controllers → requests}/spree/api/countries_controller_spec.rb +6 -7
  18. data/spec/{controllers → requests}/spree/api/credit_cards_controller_spec.rb +8 -9
  19. data/spec/{controllers → requests}/spree/api/images_controller_spec.rb +19 -16
  20. data/spec/{controllers → requests}/spree/api/inventory_units_controller_spec.rb +17 -14
  21. data/spec/{controllers → requests}/spree/api/line_items_controller_spec.rb +32 -32
  22. data/spec/{controllers → requests}/spree/api/option_types_controller_spec.rb +27 -27
  23. data/spec/{controllers → requests}/spree/api/option_values_controller_spec.rb +32 -29
  24. data/spec/{controllers → requests}/spree/api/orders_controller_spec.rb +103 -133
  25. data/spec/{controllers → requests}/spree/api/payments_controller_spec.rb +30 -44
  26. data/spec/{controllers → requests}/spree/api/product_properties_controller_spec.rb +15 -17
  27. data/spec/{controllers → requests}/spree/api/products_controller_spec.rb +44 -43
  28. data/spec/{controllers → requests}/spree/api/promotion_application_spec.rb +3 -4
  29. data/spec/{controllers → requests}/spree/api/promotions_controller_spec.rb +8 -6
  30. data/spec/{controllers → requests}/spree/api/properties_controller_spec.rb +15 -16
  31. data/spec/{controllers → requests}/spree/api/return_authorizations_controller_spec.rb +19 -21
  32. data/spec/requests/spree/api/shipments_controller_spec.rb +394 -88
  33. data/spec/{controllers → requests}/spree/api/states_controller_spec.rb +8 -9
  34. data/spec/{controllers → requests}/spree/api/stock_items_controller_spec.rb +21 -21
  35. data/spec/{controllers → requests}/spree/api/stock_locations_controller_spec.rb +18 -20
  36. data/spec/{controllers → requests}/spree/api/stock_movements_controller_spec.rb +9 -12
  37. data/spec/{controllers → requests}/spree/api/stock_transfers_controller_spec.rb +2 -3
  38. data/spec/requests/spree/api/store_credit_events_controller_spec.rb +57 -0
  39. data/spec/{controllers → requests}/spree/api/stores_controller_spec.rb +19 -20
  40. data/spec/{controllers → requests}/spree/api/taxonomies_controller_spec.rb +14 -15
  41. data/spec/{controllers → requests}/spree/api/taxons_controller_spec.rb +17 -18
  42. data/spec/{controllers → requests}/spree/api/transfer_items_controller_spec.rb +7 -9
  43. data/spec/{controllers → requests}/spree/api/unauthenticated_products_controller_spec.rb +2 -3
  44. data/spec/{controllers → requests}/spree/api/users_controller_spec.rb +18 -19
  45. data/spec/{controllers → requests}/spree/api/variants_controller_spec.rb +70 -37
  46. data/spec/{controllers → requests}/spree/api/zones_controller_spec.rb +13 -14
  47. data/spec/shared_examples/protect_product_actions.rb +3 -3
  48. data/spec/spec_helper.rb +4 -1
  49. metadata +70 -72
  50. data/spec/controllers/spree/api/shipments_controller_spec.rb +0 -301
  51. data/spec/controllers/spree/api/store_credit_events_controller_spec.rb +0 -66
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::StatesController, type: :controller do
5
- render_views
4
+ describe Api::StatesController, type: :request do
6
5
 
7
6
  let!(:state) { create(:state, name: "Victoria") }
8
7
  let(:attributes) { [:id, :name, :abbr, :country_id] }
@@ -12,13 +11,13 @@ module Spree
12
11
  end
13
12
 
14
13
  it "gets all states" do
15
- api_get :index
14
+ get spree.api_states_path
16
15
  expect(json_response["states"].first).to have_attributes(attributes)
17
16
  expect(json_response['states'].first['name']).to eq(state.name)
18
17
  end
19
18
 
20
19
  it "gets all the states for a particular country" do
21
- api_get :index, country_id: state.country.id
20
+ get spree.api_country_states_path(state.country)
22
21
  expect(json_response["states"].first).to have_attributes(attributes)
23
22
  expect(json_response['states'].first['name']).to eq(state.name)
24
23
  end
@@ -26,7 +25,7 @@ module Spree
26
25
  context "pagination" do
27
26
  it "can select the next page and control page size" do
28
27
  create(:state)
29
- api_get :index, page: 2, per_page: 1
28
+ get spree.api_states_path, params: { page: 2, per_page: 1 }
30
29
 
31
30
  expect(json_response["states"].size).to eq(1)
32
31
  expect(json_response["pages"]).to eq(2)
@@ -43,25 +42,25 @@ module Spree
43
42
  state.country = country
44
43
  state.save
45
44
 
46
- api_get :index, country_id: country.id
45
+ get spree.api_country_states_path(country)
47
46
  expect(json_response["states"].first).to have_attributes(attributes)
48
47
  expect(json_response["states"].count).to eq(1)
49
48
  json_response["states_required"] = true
50
49
  end
51
50
 
52
51
  it "can view all states" do
53
- api_get :index
52
+ get spree.api_states_path
54
53
  expect(json_response["states"].first).to have_attributes(attributes)
55
54
  end
56
55
 
57
56
  it 'can query the results through a paramter' do
58
- api_get :index, q: { name_cont: 'Vic' }
57
+ get spree.api_states_path, params: { q: { name_cont: 'Vic' } }
59
58
  expect(json_response['states'].first['name']).to eq("Victoria")
60
59
  end
61
60
  end
62
61
 
63
62
  it "can view a state" do
64
- api_get :show, id: state.id
63
+ get spree.api_state_path(state)
65
64
  expect(json_response).to have_attributes(attributes)
66
65
  end
67
66
  end
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::StockItemsController, type: :controller do
5
- render_views
4
+ describe Api::StockItemsController, type: :request do
6
5
 
7
6
  let!(:stock_location) { create(:stock_location_with_items) }
8
7
  let!(:stock_item) { stock_location.stock_items.order(:id).first }
@@ -18,7 +17,7 @@ module Spree
18
17
  context "as a normal user" do
19
18
  describe "#index" do
20
19
  it "can list stock items for an active stock location" do
21
- api_get :index, stock_location_id: stock_location.to_param
20
+ get spree.api_stock_location_stock_items_path(stock_location)
22
21
  expect(response).to be_success
23
22
  expect(json_response['stock_items'].first).to have_attributes(attributes)
24
23
  expect(json_response['stock_items'].first['variant']['sku']).to match /\ASKU-\d+\z/
@@ -26,21 +25,21 @@ module Spree
26
25
 
27
26
  it "cannot list stock items for an inactive stock location" do
28
27
  stock_location.update_attributes!(active: false)
29
- api_get :index, stock_location_id: stock_location.to_param
28
+ get spree.api_stock_location_stock_items_path(stock_location)
30
29
  expect(response).to be_not_found
31
30
  end
32
31
  end
33
32
 
34
33
  describe "#show" do
35
34
  it "can see a stock item for an active stock location" do
36
- api_get :show, stock_location_id: stock_location.to_param, id: stock_item.to_param
35
+ get spree.api_stock_location_stock_item_path(stock_location, stock_item)
37
36
  expect(json_response).to have_attributes(attributes)
38
37
  expect(json_response['count_on_hand']).to eq stock_item.count_on_hand
39
38
  end
40
39
 
41
40
  it "cannot see a stock item for an inactive stock location" do
42
41
  stock_location.update_attributes!(active: false)
43
- api_get :show, stock_location_id: stock_location.to_param, id: stock_item.to_param
42
+ get spree.api_stock_location_stock_item_path(stock_location, stock_item)
44
43
  expect(response.status).to eq(404)
45
44
  end
46
45
  end
@@ -49,28 +48,27 @@ module Spree
49
48
  it "cannot create a stock item" do
50
49
  variant = create(:variant)
51
50
  params = {
52
- stock_location_id: stock_location.to_param,
53
51
  stock_item: {
54
52
  variant_id: variant.id,
55
53
  count_on_hand: '20'
56
54
  }
57
55
  }
58
56
 
59
- api_post :create, params
57
+ post spree.api_stock_location_stock_items_path(stock_location), params: params
60
58
  expect(response.status).to eq(401)
61
59
  end
62
60
  end
63
61
 
64
62
  describe "#update" do
65
63
  it "cannot update a stock item" do
66
- api_put :update, stock_location_id: stock_location.to_param, id: stock_item.to_param
64
+ put spree.api_stock_location_stock_item_path(stock_location, stock_item)
67
65
  expect(response.status).to eq(404)
68
66
  end
69
67
  end
70
68
 
71
69
  describe "#destroy" do
72
70
  it "cannot destroy a stock item" do
73
- api_delete :destroy, stock_location_id: stock_location.to_param, id: stock_item.to_param
71
+ delete spree.api_stock_location_stock_item_path(stock_location, stock_item)
74
72
  expect(response.status).to eq(404)
75
73
  end
76
74
  end
@@ -79,33 +77,33 @@ module Spree
79
77
  context "as an admin" do
80
78
  sign_in_as_admin!
81
79
 
82
- it 'cannot list of stock items' do
83
- api_get :index, stock_location_id: stock_location.to_param
80
+ it 'can list stock items' do
81
+ get spree.api_stock_location_stock_items_path(stock_location)
84
82
  expect(json_response['stock_items'].first).to have_attributes(attributes)
85
83
  expect(json_response['stock_items'].first['variant']['sku']).to include 'SKU'
86
84
  end
87
85
 
88
86
  it 'requires a stock_location_id to be passed as a parameter' do
89
- api_get :index
87
+ get spree.api_stock_items_path
90
88
  expect(json_response['exception']).to eq('param is missing or the value is empty: stock_location_id')
91
89
  expect(response.status).to eq(422)
92
90
  end
93
91
 
94
92
  it 'can control the page size through a parameter' do
95
- api_get :index, stock_location_id: stock_location.to_param, per_page: 1
93
+ get spree.api_stock_location_stock_items_path(stock_location), params: { per_page: 1 }
96
94
  expect(json_response['count']).to eq(1)
97
95
  expect(json_response['current_page']).to eq(1)
98
96
  end
99
97
 
100
98
  it 'can query the results through a paramter' do
101
99
  stock_item.update_column(:count_on_hand, 30)
102
- api_get :index, stock_location_id: stock_location.to_param, q: { count_on_hand_eq: '30' }
100
+ get spree.api_stock_location_stock_items_path(stock_location), params: { q: { count_on_hand_eq: '30' } }
103
101
  expect(json_response['count']).to eq(1)
104
102
  expect(json_response['stock_items'].first['count_on_hand']).to eq 30
105
103
  end
106
104
 
107
105
  it 'gets a stock item' do
108
- api_get :show, stock_location_id: stock_location.to_param, id: stock_item.to_param
106
+ get spree.api_stock_location_stock_item_path(stock_location, stock_item)
109
107
  expect(json_response).to have_attributes(attributes)
110
108
  expect(json_response['count_on_hand']).to eq stock_item.count_on_hand
111
109
  end
@@ -121,7 +119,6 @@ module Spree
121
119
  let(:count_on_hand) { '20' }
122
120
  let(:params) do
123
121
  {
124
- stock_location_id: stock_location.to_param,
125
122
  stock_item: {
126
123
  variant_id: variant.id,
127
124
  count_on_hand: count_on_hand
@@ -129,7 +126,9 @@ module Spree
129
126
  }
130
127
  end
131
128
 
132
- subject { api_post :create, params }
129
+ subject do
130
+ post spree.api_stock_location_stock_items_path(stock_location), params: params
131
+ end
133
132
 
134
133
  it 'can create a new stock item' do
135
134
  subject
@@ -181,13 +180,14 @@ module Spree
181
180
  expect(stock_item.count_on_hand).to eq 10
182
181
  end
183
182
 
184
- subject { api_put :update, params }
183
+ subject do
184
+ put spree.api_stock_item_path(stock_item), params: params
185
+ end
185
186
 
186
187
  context 'adjusting count_on_hand' do
187
188
  let(:count_on_hand) { 40 }
188
189
  let(:params) do
189
190
  {
190
- id: stock_item.to_param,
191
191
  stock_item: {
192
192
  count_on_hand: count_on_hand,
193
193
  backorderable: true
@@ -301,7 +301,7 @@ module Spree
301
301
  end
302
302
 
303
303
  it 'can delete a stock item' do
304
- api_delete :destroy, id: stock_item.to_param
304
+ delete spree.api_stock_item_path(stock_item)
305
305
  expect(response.status).to eq(204)
306
306
  expect { Spree::StockItem.find(stock_item.id) }.to raise_error(ActiveRecord::RecordNotFound)
307
307
  end
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::StockLocationsController, type: :controller do
5
- render_views
4
+ describe Api::StockLocationsController, type: :request do
6
5
 
7
6
  let!(:stock_location) { create(:stock_location) }
8
7
  let!(:attributes) { [:id, :name, :address1, :address2, :city, :state_id, :state_name, :country_id, :zipcode, :phone, :active] }
@@ -14,7 +13,7 @@ module Spree
14
13
  context "as a user" do
15
14
  describe "#index" do
16
15
  it "can see active stock locations" do
17
- api_get :index
16
+ get spree.api_stock_locations_path
18
17
  expect(response).to be_success
19
18
  stock_locations = json_response['stock_locations'].map { |sl| sl['name'] }
20
19
  expect(stock_locations).to include stock_location.name
@@ -22,7 +21,7 @@ module Spree
22
21
 
23
22
  it "cannot see inactive stock locations" do
24
23
  stock_location.update_attributes!(active: false)
25
- api_get :index
24
+ get spree.api_stock_locations_path
26
25
  expect(response).to be_success
27
26
  stock_locations = json_response['stock_locations'].map { |sl| sl['name'] }
28
27
  expect(stock_locations).not_to include stock_location.name
@@ -31,14 +30,14 @@ module Spree
31
30
 
32
31
  describe "#show" do
33
32
  it "can see active stock locations" do
34
- api_get :show, id: stock_location.id
33
+ get spree.api_stock_location_path(stock_location)
35
34
  expect(response).to be_success
36
35
  expect(json_response['name']).to eq stock_location.name
37
36
  end
38
37
 
39
38
  it "cannot see inactive stock locations" do
40
39
  stock_location.update_attributes!(active: false)
41
- api_get :show, id: stock_location.id
40
+ get spree.api_stock_location_path(stock_location)
42
41
  expect(response).to be_not_found
43
42
  end
44
43
  end
@@ -52,21 +51,21 @@ module Spree
52
51
  }
53
52
  }
54
53
 
55
- api_post :create, params
54
+ post spree.api_stock_locations_path, params: params
56
55
  expect(response.status).to eq(401)
57
56
  end
58
57
  end
59
58
 
60
59
  describe "#update" do
61
60
  it "cannot update a stock location" do
62
- api_put :update, stock_location: { name: "South Pole" }, id: stock_location.to_param
61
+ put spree.api_stock_location_path(stock_location), params: { stock_location: { name: "South Pole" } }
63
62
  expect(response.status).to eq(401)
64
63
  end
65
64
  end
66
65
 
67
66
  describe "#destroy" do
68
67
  it "cannot delete a stock location" do
69
- api_put :destroy, id: stock_location.to_param
68
+ delete spree.api_stock_location_path(stock_location)
70
69
  expect(response.status).to eq(401)
71
70
  end
72
71
  end
@@ -77,7 +76,7 @@ module Spree
77
76
 
78
77
  describe "#index" do
79
78
  it "can see active stock locations" do
80
- api_get :index
79
+ get spree.api_stock_locations_path
81
80
  expect(response).to be_success
82
81
  stock_locations = json_response['stock_locations'].map { |sl| sl['name'] }
83
82
  expect(stock_locations).to include stock_location.name
@@ -85,14 +84,14 @@ module Spree
85
84
 
86
85
  it "can see inactive stock locations" do
87
86
  stock_location.update_attributes!(active: false)
88
- api_get :index
87
+ get spree.api_stock_locations_path
89
88
  expect(response).to be_success
90
89
  stock_locations = json_response['stock_locations'].map { |sl| sl['name'] }
91
90
  expect(stock_locations).to include stock_location.name
92
91
  end
93
92
 
94
93
  it "gets stock location information" do
95
- api_get :index
94
+ get spree.api_stock_locations_path
96
95
  expect(json_response['stock_locations'].first).to have_attributes(attributes)
97
96
  expect(json_response['stock_locations'].first['country']).not_to be_nil
98
97
  expect(json_response['stock_locations'].first['state']).not_to be_nil
@@ -100,7 +99,7 @@ module Spree
100
99
 
101
100
  it 'can control the page size through a parameter' do
102
101
  create(:stock_location)
103
- api_get :index, per_page: 1
102
+ get spree.api_stock_locations_path, params: { per_page: 1 }
104
103
  expect(json_response['count']).to eq(1)
105
104
  expect(json_response['current_page']).to eq(1)
106
105
  expect(json_response['pages']).to eq(2)
@@ -108,7 +107,7 @@ module Spree
108
107
 
109
108
  it 'can query the results through a paramter' do
110
109
  expected_result = create(:stock_location, name: 'South America')
111
- api_get :index, q: { name_cont: 'south' }
110
+ get spree.api_stock_locations_path, params: { q: { name_cont: 'south' } }
112
111
  expect(json_response['count']).to eq(1)
113
112
  expect(json_response['stock_locations'].first['name']).to eq expected_result.name
114
113
  end
@@ -116,14 +115,14 @@ module Spree
116
115
 
117
116
  describe "#show" do
118
117
  it "can see active stock locations" do
119
- api_get :show, id: stock_location.id
118
+ get spree.api_stock_location_path(stock_location)
120
119
  expect(response).to be_success
121
120
  expect(json_response['name']).to eq stock_location.name
122
121
  end
123
122
 
124
123
  it "can see inactive stock locations" do
125
124
  stock_location.update_attributes!(active: false)
126
- api_get :show, id: stock_location.id
125
+ get spree.api_stock_location_path(stock_location)
127
126
  expect(response).to be_success
128
127
  expect(json_response['name']).to eq stock_location.name
129
128
  end
@@ -138,7 +137,7 @@ module Spree
138
137
  }
139
138
  }
140
139
 
141
- api_post :create, params
140
+ post spree.api_stock_locations_path, params: params
142
141
  expect(response.status).to eq(201)
143
142
  expect(json_response).to have_attributes(attributes)
144
143
  end
@@ -147,13 +146,12 @@ module Spree
147
146
  describe "#update" do
148
147
  it "can update a stock location" do
149
148
  params = {
150
- id: stock_location.to_param,
151
149
  stock_location: {
152
150
  name: "South Pole"
153
151
  }
154
152
  }
155
153
 
156
- api_put :update, params
154
+ put spree.api_stock_location_path(stock_location), params: params
157
155
  expect(response.status).to eq(200)
158
156
  expect(json_response['name']).to eq 'South Pole'
159
157
  end
@@ -161,7 +159,7 @@ module Spree
161
159
 
162
160
  describe "#destroy" do
163
161
  it "can delete a stock location" do
164
- api_delete :destroy, id: stock_location.to_param
162
+ delete spree.api_stock_location_path(stock_location)
165
163
  expect(response.status).to eq(204)
166
164
  expect { stock_location.reload }.to raise_error(ActiveRecord::RecordNotFound)
167
165
  end
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::StockMovementsController, type: :controller do
5
- render_views
4
+ describe Api::StockMovementsController, type: :request do
6
5
 
7
6
  let!(:stock_location) { create(:stock_location_with_items) }
8
7
  let!(:stock_item) { stock_location.stock_items.order(:id).first }
@@ -15,24 +14,23 @@ module Spree
15
14
 
16
15
  context 'as a user' do
17
16
  it 'cannot see a list of stock movements' do
18
- api_get :index, stock_location_id: stock_location.to_param
17
+ get spree.api_stock_location_stock_movements_path(stock_location)
19
18
  expect(response.status).to eq(401)
20
19
  end
21
20
 
22
21
  it 'cannot see a stock movement' do
23
- api_get :show, stock_location_id: stock_location.to_param, id: stock_movement.id
22
+ get spree.api_stock_location_stock_movement_path(stock_location, stock_movement)
24
23
  expect(response.status).to eq(404)
25
24
  end
26
25
 
27
26
  it 'cannot create a stock movement' do
28
27
  params = {
29
- stock_location_id: stock_location.to_param,
30
28
  stock_movement: {
31
29
  stock_item_id: stock_item.to_param
32
30
  }
33
31
  }
34
32
 
35
- api_post :create, params
33
+ post spree.api_stock_location_stock_movements_path(stock_location), params: params
36
34
  expect(response.status).to eq(401)
37
35
  end
38
36
  end
@@ -41,14 +39,14 @@ module Spree
41
39
  sign_in_as_admin!
42
40
 
43
41
  it 'gets list of stock movements' do
44
- api_get :index, stock_location_id: stock_location.to_param
42
+ get spree.api_stock_location_stock_movements_path(stock_location)
45
43
  expect(json_response['stock_movements'].first).to have_attributes(attributes)
46
44
  expect(json_response['stock_movements'].first['stock_item']['count_on_hand']).to eq 11
47
45
  end
48
46
 
49
47
  it 'can control the page size through a parameter' do
50
48
  create(:stock_movement, stock_item: stock_item)
51
- api_get :index, stock_location_id: stock_location.to_param, per_page: 1
49
+ get spree.api_stock_location_stock_movements_path(stock_location), params: { per_page: 1 }
52
50
  expect(json_response['count']).to eq(1)
53
51
  expect(json_response['current_page']).to eq(1)
54
52
  expect(json_response['pages']).to eq(2)
@@ -56,25 +54,24 @@ module Spree
56
54
 
57
55
  it 'can query the results through a paramter' do
58
56
  create(:stock_movement, :received, quantity: 10, stock_item: stock_item)
59
- api_get :index, stock_location_id: stock_location.to_param, q: { quantity_eq: '10' }
57
+ get spree.api_stock_location_stock_movements_path(stock_location), params: { q: { quantity_eq: '10' } }
60
58
  expect(json_response['count']).to eq(1)
61
59
  end
62
60
 
63
61
  it 'gets a stock movement' do
64
- api_get :show, stock_location_id: stock_location.to_param, id: stock_movement.to_param
62
+ get spree.api_stock_location_stock_movement_path(stock_location, stock_movement)
65
63
  expect(json_response).to have_attributes(attributes)
66
64
  expect(json_response['stock_item_id']).to eq stock_movement.stock_item_id
67
65
  end
68
66
 
69
67
  it 'can create a new stock movement' do
70
68
  params = {
71
- stock_location_id: stock_location.to_param,
72
69
  stock_movement: {
73
70
  stock_item_id: stock_item.to_param
74
71
  }
75
72
  }
76
73
 
77
- api_post :create, params
74
+ post spree.api_stock_location_stock_movements_path(stock_location), params: params
78
75
  expect(response.status).to eq(201)
79
76
  expect(json_response).to have_attributes(attributes)
80
77
  end