spree_api 2.3.4 → 2.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spree/api/base_controller.rb +2 -2
  3. data/app/controllers/spree/api/option_types_controller.rb +2 -2
  4. data/app/controllers/spree/api/shipments_controller.rb +2 -2
  5. data/app/controllers/spree/api/taxons_controller.rb +1 -1
  6. data/app/helpers/spree/api/api_helpers.rb +0 -2
  7. data/app/views/spree/api/shipments/small.v1.rabl +4 -0
  8. data/app/views/spree/api/variants/small.v1.rabl +2 -0
  9. data/lib/spree/api/testing_support/helpers.rb +6 -6
  10. data/lib/spree/api/testing_support/setup.rb +2 -2
  11. data/spec/controllers/spree/api/addresses_controller_spec.rb +7 -7
  12. data/spec/controllers/spree/api/base_controller_spec.rb +20 -20
  13. data/spec/controllers/spree/api/checkouts_controller_spec.rb +53 -53
  14. data/spec/controllers/spree/api/classifications_controller_spec.rb +5 -5
  15. data/spec/controllers/spree/api/config_controller_spec.rb +9 -9
  16. data/spec/controllers/spree/api/countries_controller_spec.rb +11 -11
  17. data/spec/controllers/spree/api/credit_cards_controller_spec.rb +16 -16
  18. data/spec/controllers/spree/api/images_controller_spec.rb +11 -11
  19. data/spec/controllers/spree/api/inventory_units_controller_spec.rb +6 -6
  20. data/spec/controllers/spree/api/line_items_controller_spec.rb +33 -33
  21. data/spec/controllers/spree/api/option_types_controller_spec.rb +18 -18
  22. data/spec/controllers/spree/api/option_values_controller_spec.rb +21 -21
  23. data/spec/controllers/spree/api/orders_controller_spec.rb +170 -132
  24. data/spec/controllers/spree/api/payments_controller_spec.rb +46 -46
  25. data/spec/controllers/spree/api/product_properties_controller_spec.rb +21 -21
  26. data/spec/controllers/spree/api/products_controller_spec.rb +67 -67
  27. data/spec/controllers/spree/api/promotion_application_spec.rb +11 -11
  28. data/spec/controllers/spree/api/properties_controller_spec.rb +25 -25
  29. data/spec/controllers/spree/api/return_authorizations_controller_spec.rb +40 -40
  30. data/spec/controllers/spree/api/shipments_controller_spec.rb +53 -30
  31. data/spec/controllers/spree/api/states_controller_spec.rb +18 -18
  32. data/spec/controllers/spree/api/stock_items_controller_spec.rb +26 -26
  33. data/spec/controllers/spree/api/stock_locations_controller_spec.rb +22 -22
  34. data/spec/controllers/spree/api/stock_movements_controller_spec.rb +16 -16
  35. data/spec/controllers/spree/api/taxonomies_controller_spec.rb +24 -24
  36. data/spec/controllers/spree/api/taxons_controller_spec.rb +39 -39
  37. data/spec/controllers/spree/api/unauthenticated_products_controller_spec.rb +5 -5
  38. data/spec/controllers/spree/api/users_controller_spec.rb +25 -25
  39. data/spec/controllers/spree/api/variants_controller_spec.rb +36 -36
  40. data/spec/controllers/spree/api/zones_controller_spec.rb +20 -20
  41. data/spec/models/spree/legacy_user_spec.rb +5 -5
  42. data/spec/requests/rabl_cache_spec.rb +9 -9
  43. data/spec/spec_helper.rb +0 -1
  44. metadata +4 -4
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::StatesController do
4
+ describe Api::StatesController, :type => :controller do
5
5
  render_views
6
6
 
7
7
  let!(:state) { create(:state, :name => "Victoria") }
@@ -13,37 +13,37 @@ module Spree
13
13
 
14
14
  it "gets all states" do
15
15
  api_get :index
16
- json_response["states"].first.should have_attributes(attributes)
17
- json_response['states'].first['name'].should eq(state.name)
16
+ expect(json_response["states"].first).to have_attributes(attributes)
17
+ expect(json_response['states'].first['name']).to eq(state.name)
18
18
  end
19
19
 
20
20
  it "gets all the states for a particular country" do
21
21
  api_get :index, :country_id => state.country.id
22
- json_response["states"].first.should have_attributes(attributes)
23
- json_response['states'].first['name'].should eq(state.name)
22
+ expect(json_response["states"].first).to have_attributes(attributes)
23
+ expect(json_response['states'].first['name']).to eq(state.name)
24
24
  end
25
25
 
26
26
  context "pagination" do
27
27
  before do
28
- State.should_receive(:accessible_by).and_return(@scope = double)
29
- @scope.stub_chain(:ransack, :result, :includes, :order).and_return(@scope)
28
+ expect(State).to receive(:accessible_by).and_return(@scope = double)
29
+ allow(@scope).to receive_message_chain(:ransack, :result, :includes, :order).and_return(@scope)
30
30
  end
31
31
 
32
32
  it "does not paginate states results when asked not to do so" do
33
- @scope.should_not_receive(:page)
34
- @scope.should_not_receive(:per)
33
+ expect(@scope).not_to receive(:page)
34
+ expect(@scope).not_to receive(:per)
35
35
  api_get :index
36
36
  end
37
37
 
38
38
  it "paginates when page parameter is passed through" do
39
- @scope.should_receive(:page).with(1).and_return(@scope)
40
- @scope.should_receive(:per).with(nil)
39
+ expect(@scope).to receive(:page).with(1).and_return(@scope)
40
+ expect(@scope).to receive(:per).with(nil)
41
41
  api_get :index, :page => 1
42
42
  end
43
43
 
44
44
  it "paginates when per_page parameter is passed through" do
45
- @scope.should_receive(:page).with(nil).and_return(@scope)
46
- @scope.should_receive(:per).with(25)
45
+ expect(@scope).to receive(:page).with(nil).and_return(@scope)
46
+ expect(@scope).to receive(:per).with(25)
47
47
  api_get :index, :per_page => 25
48
48
  end
49
49
  end
@@ -58,25 +58,25 @@ module Spree
58
58
  state.save
59
59
 
60
60
  api_get :index, :country_id => country.id
61
- json_response["states"].first.should have_attributes(attributes)
62
- json_response["states"].count.should == 1
61
+ expect(json_response["states"].first).to have_attributes(attributes)
62
+ expect(json_response["states"].count).to eq(1)
63
63
  json_response["states_required"] = true
64
64
  end
65
65
 
66
66
  it "can view all states" do
67
67
  api_get :index
68
- json_response["states"].first.should have_attributes(attributes)
68
+ expect(json_response["states"].first).to have_attributes(attributes)
69
69
  end
70
70
 
71
71
  it 'can query the results through a paramter' do
72
72
  api_get :index, :q => { :name_cont => 'Vic' }
73
- json_response['states'].first['name'].should eq("Victoria")
73
+ expect(json_response['states'].first['name']).to eq("Victoria")
74
74
  end
75
75
  end
76
76
 
77
77
  it "can view a state" do
78
78
  api_get :show, :id => state.id
79
- json_response.should have_attributes(attributes)
79
+ expect(json_response).to have_attributes(attributes)
80
80
  end
81
81
  end
82
82
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::StockItemsController do
4
+ describe Api::StockItemsController, :type => :controller do
5
5
  render_views
6
6
 
7
7
  let!(:stock_location) { create(:stock_location_with_items) }
@@ -16,12 +16,12 @@ module Spree
16
16
  context "as a normal user" do
17
17
  it "cannot list stock items for a stock location" do
18
18
  api_get :index, stock_location_id: stock_location.to_param
19
- response.status.should == 404
19
+ expect(response.status).to eq(404)
20
20
  end
21
21
 
22
22
  it "cannot see a stock item" do
23
23
  api_get :show, stock_location_id: stock_location.to_param, id: stock_item.to_param
24
- response.status.should == 404
24
+ expect(response.status).to eq(404)
25
25
  end
26
26
 
27
27
  it "cannot create a stock item" do
@@ -35,17 +35,17 @@ module Spree
35
35
  }
36
36
 
37
37
  api_post :create, params
38
- response.status.should == 404
38
+ expect(response.status).to eq(404)
39
39
  end
40
40
 
41
41
  it "cannot update a stock item" do
42
42
  api_put :update, stock_location_id: stock_location.to_param, stock_item_id: stock_item.to_param
43
- response.status.should == 404
43
+ expect(response.status).to eq(404)
44
44
  end
45
45
 
46
46
  it "cannot destroy a stock item" do
47
47
  api_delete :destroy, stock_location_id: stock_location.to_param, stock_item_id: stock_item.to_param
48
- response.status.should == 404
48
+ expect(response.status).to eq(404)
49
49
  end
50
50
  end
51
51
 
@@ -54,33 +54,33 @@ module Spree
54
54
 
55
55
  it 'cannot list of stock items' do
56
56
  api_get :index, stock_location_id: stock_location.to_param
57
- json_response['stock_items'].first.should have_attributes(attributes)
58
- json_response['stock_items'].first['variant']['sku'].should include 'SKU'
57
+ expect(json_response['stock_items'].first).to have_attributes(attributes)
58
+ expect(json_response['stock_items'].first['variant']['sku']).to include 'SKU'
59
59
  end
60
60
 
61
61
  it 'requires a stock_location_id to be passed as a parameter' do
62
62
  api_get :index
63
- json_response['error'].should =~ /stock_location_id parameter must be provided/
64
- response.status.should == 422
63
+ expect(json_response['error']).to match(/stock_location_id parameter must be provided/)
64
+ expect(response.status).to eq(422)
65
65
  end
66
66
 
67
67
  it 'can control the page size through a parameter' do
68
68
  api_get :index, stock_location_id: stock_location.to_param, per_page: 1
69
- json_response['count'].should == 1
70
- json_response['current_page'].should == 1
69
+ expect(json_response['count']).to eq(1)
70
+ expect(json_response['current_page']).to eq(1)
71
71
  end
72
72
 
73
73
  it 'can query the results through a paramter' do
74
74
  stock_item.update_column(:count_on_hand, 30)
75
75
  api_get :index, stock_location_id: stock_location.to_param, q: { count_on_hand_eq: '30' }
76
- json_response['count'].should == 1
77
- json_response['stock_items'].first['count_on_hand'].should eq 30
76
+ expect(json_response['count']).to eq(1)
77
+ expect(json_response['stock_items'].first['count_on_hand']).to eq 30
78
78
  end
79
79
 
80
80
  it 'gets a stock item' do
81
81
  api_get :show, stock_location_id: stock_location.to_param, id: stock_item.to_param
82
- json_response.should have_attributes(attributes)
83
- json_response['count_on_hand'].should eq stock_item.count_on_hand
82
+ expect(json_response).to have_attributes(attributes)
83
+ expect(json_response['count_on_hand']).to eq stock_item.count_on_hand
84
84
  end
85
85
 
86
86
  it 'can create a new stock item' do
@@ -97,12 +97,12 @@ module Spree
97
97
  }
98
98
 
99
99
  api_post :create, params
100
- response.status.should == 201
101
- json_response.should have_attributes(attributes)
100
+ expect(response.status).to eq(201)
101
+ expect(json_response).to have_attributes(attributes)
102
102
  end
103
103
 
104
104
  it 'can update a stock item to add new inventory' do
105
- stock_item.count_on_hand.should == 10
105
+ expect(stock_item.count_on_hand).to eq(10)
106
106
  params = {
107
107
  id: stock_item.to_param,
108
108
  stock_item: {
@@ -111,12 +111,12 @@ module Spree
111
111
  }
112
112
 
113
113
  api_put :update, params
114
- response.status.should == 200
115
- json_response['count_on_hand'].should eq 50
114
+ expect(response.status).to eq(200)
115
+ expect(json_response['count_on_hand']).to eq 50
116
116
  end
117
117
 
118
118
  it 'can set a stock item to modify the current inventory' do
119
- stock_item.count_on_hand.should == 10
119
+ expect(stock_item.count_on_hand).to eq(10)
120
120
 
121
121
  params = {
122
122
  id: stock_item.to_param,
@@ -127,14 +127,14 @@ module Spree
127
127
  }
128
128
 
129
129
  api_put :update, params
130
- response.status.should == 200
131
- json_response['count_on_hand'].should eq 40
130
+ expect(response.status).to eq(200)
131
+ expect(json_response['count_on_hand']).to eq 40
132
132
  end
133
133
 
134
134
  it 'can delete a stock item' do
135
135
  api_delete :destroy, id: stock_item.to_param
136
- response.status.should == 204
137
- lambda { Spree::StockItem.find(stock_item.id) }.should raise_error(ActiveRecord::RecordNotFound)
136
+ expect(response.status).to eq(204)
137
+ expect { Spree::StockItem.find(stock_item.id) }.to raise_error(ActiveRecord::RecordNotFound)
138
138
  end
139
139
  end
140
140
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::StockLocationsController do
4
+ describe Api::StockLocationsController, :type => :controller do
5
5
  render_views
6
6
 
7
7
  let!(:stock_location) { create(:stock_location) }
@@ -14,12 +14,12 @@ module Spree
14
14
  context "as a user" do
15
15
  it "cannot see stock locations" do
16
16
  api_get :index
17
- response.status.should == 401
17
+ expect(response.status).to eq(401)
18
18
  end
19
19
 
20
20
  it "cannot see a single stock location" do
21
21
  api_get :show, :id => stock_location.id
22
- response.status.should == 404
22
+ expect(response.status).to eq(404)
23
23
  end
24
24
 
25
25
  it "cannot create a new stock location" do
@@ -31,17 +31,17 @@ module Spree
31
31
  }
32
32
 
33
33
  api_post :create, params
34
- response.status.should == 401
34
+ expect(response.status).to eq(401)
35
35
  end
36
36
 
37
37
  it "cannot update a stock location" do
38
38
  api_put :update, :stock_location => { :name => "South Pole" }, :id => stock_location.to_param
39
- response.status.should == 404
39
+ expect(response.status).to eq(404)
40
40
  end
41
41
 
42
42
  it "cannot delete a stock location" do
43
43
  api_put :destroy, :id => stock_location.to_param
44
- response.status.should == 404
44
+ expect(response.status).to eq(404)
45
45
  end
46
46
  end
47
47
 
@@ -51,30 +51,30 @@ module Spree
51
51
 
52
52
  it "gets list of stock locations" do
53
53
  api_get :index
54
- json_response['stock_locations'].first.should have_attributes(attributes)
55
- json_response['stock_locations'].first['country'].should_not be_nil
56
- json_response['stock_locations'].first['state'].should_not be_nil
54
+ expect(json_response['stock_locations'].first).to have_attributes(attributes)
55
+ expect(json_response['stock_locations'].first['country']).not_to be_nil
56
+ expect(json_response['stock_locations'].first['state']).not_to be_nil
57
57
  end
58
58
 
59
59
  it 'can control the page size through a parameter' do
60
60
  create(:stock_location)
61
61
  api_get :index, per_page: 1
62
- json_response['count'].should == 1
63
- json_response['current_page'].should == 1
64
- json_response['pages'].should == 2
62
+ expect(json_response['count']).to eq(1)
63
+ expect(json_response['current_page']).to eq(1)
64
+ expect(json_response['pages']).to eq(2)
65
65
  end
66
66
 
67
67
  it 'can query the results through a paramter' do
68
68
  expected_result = create(:stock_location, name: 'South America')
69
69
  api_get :index, q: { name_cont: 'south' }
70
- json_response['count'].should == 1
71
- json_response['stock_locations'].first['name'].should eq expected_result.name
70
+ expect(json_response['count']).to eq(1)
71
+ expect(json_response['stock_locations'].first['name']).to eq expected_result.name
72
72
  end
73
73
 
74
74
  it "gets a stock location" do
75
75
  api_get :show, id: stock_location.to_param
76
- json_response.should have_attributes(attributes)
77
- json_response['name'].should eq stock_location.name
76
+ expect(json_response).to have_attributes(attributes)
77
+ expect(json_response['name']).to eq stock_location.name
78
78
  end
79
79
 
80
80
  it "can create a new stock location" do
@@ -86,8 +86,8 @@ module Spree
86
86
  }
87
87
 
88
88
  api_post :create, params
89
- response.status.should == 201
90
- json_response.should have_attributes(attributes)
89
+ expect(response.status).to eq(201)
90
+ expect(json_response).to have_attributes(attributes)
91
91
  end
92
92
 
93
93
  it "can update a stock location" do
@@ -99,14 +99,14 @@ module Spree
99
99
  }
100
100
 
101
101
  api_put :update, params
102
- response.status.should == 200
103
- json_response['name'].should eq 'South Pole'
102
+ expect(response.status).to eq(200)
103
+ expect(json_response['name']).to eq 'South Pole'
104
104
  end
105
105
 
106
106
  it "can delete a stock location" do
107
107
  api_delete :destroy, id: stock_location.to_param
108
- response.status.should == 204
109
- lambda { stock_location.reload }.should raise_error(ActiveRecord::RecordNotFound)
108
+ expect(response.status).to eq(204)
109
+ expect { stock_location.reload }.to raise_error(ActiveRecord::RecordNotFound)
110
110
  end
111
111
  end
112
112
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::StockMovementsController do
4
+ describe Api::StockMovementsController, :type => :controller do
5
5
  render_views
6
6
 
7
7
  let!(:stock_location) { create(:stock_location_with_items) }
@@ -16,12 +16,12 @@ module Spree
16
16
  context 'as a user' do
17
17
  it 'cannot see a list of stock movements' do
18
18
  api_get :index, stock_location_id: stock_location.to_param
19
- response.status.should == 404
19
+ expect(response.status).to eq(404)
20
20
  end
21
21
 
22
22
  it 'cannot see a stock movement' do
23
23
  api_get :show, stock_location_id: stock_location.to_param, id: stock_movement.id
24
- response.status.should == 404
24
+ expect(response.status).to eq(404)
25
25
  end
26
26
 
27
27
  it 'cannot create a stock movement' do
@@ -33,7 +33,7 @@ module Spree
33
33
  }
34
34
 
35
35
  api_post :create, params
36
- response.status.should == 404
36
+ expect(response.status).to eq(404)
37
37
  end
38
38
  end
39
39
 
@@ -42,34 +42,34 @@ module Spree
42
42
 
43
43
  it 'gets list of stock movements' do
44
44
  api_get :index, stock_location_id: stock_location.to_param
45
- json_response['stock_movements'].first.should have_attributes(attributes)
46
- json_response['stock_movements'].first['stock_item']['count_on_hand'].should eq 11
45
+ expect(json_response['stock_movements'].first).to have_attributes(attributes)
46
+ expect(json_response['stock_movements'].first['stock_item']['count_on_hand']).to eq 11
47
47
  end
48
48
 
49
49
  it 'requires a stock_location_id to be passed as a parameter' do
50
50
  api_get :index
51
- json_response['error'].should =~ /stock_location_id parameter must be provided/
52
- response.status.should == 422
51
+ expect(json_response['error']).to match(/stock_location_id parameter must be provided/)
52
+ expect(response.status).to eq(422)
53
53
  end
54
54
 
55
55
  it 'can control the page size through a parameter' do
56
56
  create(:stock_movement, stock_item: stock_item)
57
57
  api_get :index, stock_location_id: stock_location.to_param, per_page: 1
58
- json_response['count'].should == 1
59
- json_response['current_page'].should == 1
60
- json_response['pages'].should == 2
58
+ expect(json_response['count']).to eq(1)
59
+ expect(json_response['current_page']).to eq(1)
60
+ expect(json_response['pages']).to eq(2)
61
61
  end
62
62
 
63
63
  it 'can query the results through a paramter' do
64
64
  expected_result = create(:stock_movement, :received, quantity: 10, stock_item: stock_item)
65
65
  api_get :index, stock_location_id: stock_location.to_param, q: { quantity_eq: '10' }
66
- json_response['count'].should == 1
66
+ expect(json_response['count']).to eq(1)
67
67
  end
68
68
 
69
69
  it 'gets a stock movement' do
70
70
  api_get :show, stock_location_id: stock_location.to_param, id: stock_movement.to_param
71
- json_response.should have_attributes(attributes)
72
- json_response['stock_item_id'].should eq stock_movement.stock_item_id
71
+ expect(json_response).to have_attributes(attributes)
72
+ expect(json_response['stock_item_id']).to eq stock_movement.stock_item_id
73
73
  end
74
74
 
75
75
  it 'can create a new stock movement' do
@@ -81,8 +81,8 @@ module Spree
81
81
  }
82
82
 
83
83
  api_post :create, params
84
- response.status.should == 201
85
- json_response.should have_attributes(attributes)
84
+ expect(response.status).to eq(201)
85
+ expect(json_response).to have_attributes(attributes)
86
86
  end
87
87
  end
88
88
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module Spree
4
- describe Api::TaxonomiesController do
4
+ describe Api::TaxonomiesController, :type => :controller do
5
5
  render_views
6
6
 
7
7
  let(:taxonomy) { create(:taxonomy) }
@@ -20,57 +20,57 @@ module Spree
20
20
  it "gets all taxonomies" do
21
21
  api_get :index
22
22
 
23
- json_response["taxonomies"].first['name'].should eq taxonomy.name
24
- json_response["taxonomies"].first['root']['taxons'].count.should eq 1
23
+ expect(json_response["taxonomies"].first['name']).to eq taxonomy.name
24
+ expect(json_response["taxonomies"].first['root']['taxons'].count).to eq 1
25
25
  end
26
26
 
27
27
  it 'can control the page size through a parameter' do
28
28
  create(:taxonomy)
29
29
  api_get :index, :per_page => 1
30
- json_response['count'].should == 1
31
- json_response['current_page'].should == 1
32
- json_response['pages'].should == 2
30
+ expect(json_response['count']).to eq(1)
31
+ expect(json_response['current_page']).to eq(1)
32
+ expect(json_response['pages']).to eq(2)
33
33
  end
34
34
 
35
35
  it 'can query the results through a paramter' do
36
36
  expected_result = create(:taxonomy, :name => 'Style')
37
37
  api_get :index, :q => { :name_cont => 'style' }
38
- json_response['count'].should == 1
39
- json_response['taxonomies'].first['name'].should eq expected_result.name
38
+ expect(json_response['count']).to eq(1)
39
+ expect(json_response['taxonomies'].first['name']).to eq expected_result.name
40
40
  end
41
41
 
42
42
  it "gets a single taxonomy" do
43
43
  api_get :show, :id => taxonomy.id
44
44
 
45
- json_response['name'].should eq taxonomy.name
45
+ expect(json_response['name']).to eq taxonomy.name
46
46
 
47
47
  children = json_response['root']['taxons']
48
- children.count.should eq 1
49
- children.first['name'].should eq taxon.name
50
- children.first.key?('taxons').should be false
48
+ expect(children.count).to eq 1
49
+ expect(children.first['name']).to eq taxon.name
50
+ expect(children.first.key?('taxons')).to be false
51
51
  end
52
52
 
53
53
  it "gets a single taxonomy with set=nested" do
54
54
  api_get :show, :id => taxonomy.id, :set => 'nested'
55
55
 
56
- json_response['name'].should eq taxonomy.name
56
+ expect(json_response['name']).to eq taxonomy.name
57
57
 
58
58
  children = json_response['root']['taxons']
59
- children.first.key?('taxons').should be true
59
+ expect(children.first.key?('taxons')).to be true
60
60
  end
61
61
 
62
62
  it "gets the jstree-friendly version of a taxonomy" do
63
63
  api_get :jstree, :id => taxonomy.id
64
- json_response["data"].should eq(taxonomy.root.name)
65
- json_response["attr"].should eq({ "id" => taxonomy.root.id, "name" => taxonomy.root.name})
66
- json_response["state"].should eq("closed")
64
+ expect(json_response["data"]).to eq(taxonomy.root.name)
65
+ expect(json_response["attr"]).to eq({ "id" => taxonomy.root.id, "name" => taxonomy.root.name})
66
+ expect(json_response["state"]).to eq("closed")
67
67
  end
68
68
 
69
69
  it "can learn how to create a new taxonomy" do
70
70
  api_get :new
71
- json_response["attributes"].should == attributes.map(&:to_s)
71
+ expect(json_response["attributes"]).to eq(attributes.map(&:to_s))
72
72
  required_attributes = json_response["required_attributes"]
73
- required_attributes.should include("name")
73
+ expect(required_attributes).to include("name")
74
74
  end
75
75
 
76
76
  it "cannot create a new taxonomy if not an admin" do
@@ -94,20 +94,20 @@ module Spree
94
94
 
95
95
  it "can create" do
96
96
  api_post :create, :taxonomy => { :name => "Colors"}
97
- json_response.should have_attributes(attributes)
98
- response.status.should == 201
97
+ expect(json_response).to have_attributes(attributes)
98
+ expect(response.status).to eq(201)
99
99
  end
100
100
 
101
101
  it "cannot create a new taxonomy with invalid attributes" do
102
102
  api_post :create, :taxonomy => {}
103
- response.status.should == 422
104
- json_response["error"].should == "Invalid resource. Please fix errors and try again."
103
+ expect(response.status).to eq(422)
104
+ expect(json_response["error"]).to eq("Invalid resource. Please fix errors and try again.")
105
105
  errors = json_response["errors"]
106
106
  end
107
107
 
108
108
  it "can destroy" do
109
109
  api_delete :destroy, :id => taxonomy.id
110
- response.status.should == 204
110
+ expect(response.status).to eq(204)
111
111
  end
112
112
  end
113
113
  end