spree_backend 3.1.5 → 3.1.6
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/admin/orders_controller.rb +1 -3
- data/app/controllers/spree/admin/products_controller.rb +1 -1
- data/app/views/spree/admin/products/_form.html.erb +8 -8
- data/app/views/spree/admin/products/index.html.erb +1 -1
- data/app/views/spree/admin/shared/_product_tabs.html.erb +4 -4
- data/app/views/spree/admin/taxons/edit.html.erb +1 -1
- data/spree_backend.gemspec +1 -1
- metadata +7 -98
- data/spec/controllers/spree/admin/base_controller_spec.rb +0 -46
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -185
- data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -197
- data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -254
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -49
- data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -97
- data/spec/controllers/spree/admin/products_controller_spec.rb +0 -99
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -44
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -74
- data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -42
- data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -252
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -225
- data/spec/controllers/spree/admin/return_index_controller_spec.rb +0 -37
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
- data/spec/controllers/spree/admin/root_controller_spec.rb +0 -35
- data/spec/controllers/spree/admin/search_controller_spec.rb +0 -56
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -19
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/tax_categories_controller_spec.rb +0 -34
- data/spec/controllers/spree/admin/users_controller_spec.rb +0 -161
- data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
- data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -47
- data/spec/features/admin/configuration/countries_spec.rb +0 -24
- data/spec/features/admin/configuration/general_settings_spec.rb +0 -44
- data/spec/features/admin/configuration/payment_methods_spec.rb +0 -63
- data/spec/features/admin/configuration/roles_spec.rb +0 -47
- data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -62
- data/spec/features/admin/configuration/states_spec.rb +0 -68
- data/spec/features/admin/configuration/stock_locations_spec.rb +0 -48
- data/spec/features/admin/configuration/store_credit_categories_spec.rb +0 -50
- data/spec/features/admin/configuration/tax_categories_spec.rb +0 -56
- data/spec/features/admin/configuration/tax_rates_spec.rb +0 -18
- data/spec/features/admin/configuration/zones_spec.rb +0 -39
- data/spec/features/admin/homepage_spec.rb +0 -89
- data/spec/features/admin/locale_spec.rb +0 -31
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
- data/spec/features/admin/orders/adjustments_spec.rb +0 -129
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -47
- data/spec/features/admin/orders/customer_details_spec.rb +0 -154
- data/spec/features/admin/orders/line_items_spec.rb +0 -51
- data/spec/features/admin/orders/listing_spec.rb +0 -222
- data/spec/features/admin/orders/log_entries_spec.rb +0 -55
- data/spec/features/admin/orders/new_order_spec.rb +0 -160
- data/spec/features/admin/orders/order_details_spec.rb +0 -662
- data/spec/features/admin/orders/payments_spec.rb +0 -230
- data/spec/features/admin/orders/risk_analysis_spec.rb +0 -48
- data/spec/features/admin/orders/shipments_spec.rb +0 -64
- data/spec/features/admin/orders/state_changes_spec.rb +0 -21
- data/spec/features/admin/products/edit/images_spec.rb +0 -86
- data/spec/features/admin/products/edit/products_spec.rb +0 -64
- data/spec/features/admin/products/edit/taxons_spec.rb +0 -41
- data/spec/features/admin/products/edit/variants_spec.rb +0 -56
- data/spec/features/admin/products/option_types_spec.rb +0 -114
- data/spec/features/admin/products/products_spec.rb +0 -445
- data/spec/features/admin/products/properties_spec.rb +0 -147
- data/spec/features/admin/products/prototypes_spec.rb +0 -112
- data/spec/features/admin/products/stock_management_spec.rb +0 -124
- data/spec/features/admin/products/taxonomies_spec.rb +0 -52
- data/spec/features/admin/products/variant_spec.rb +0 -50
- data/spec/features/admin/promotions/adjustments_spec.rb +0 -259
- data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -70
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -70
- data/spec/features/admin/refund_reasons/refund_reasons_spec.rb +0 -57
- data/spec/features/admin/reports_spec.rb +0 -61
- data/spec/features/admin/return_authorization_reasons/return_authorization_reasons_spec.rb +0 -63
- data/spec/features/admin/returns/customer_returns_spec.rb +0 -80
- data/spec/features/admin/returns/return_authorizations_spec.rb +0 -152
- data/spec/features/admin/stock_transfer_spec.rb +0 -75
- data/spec/features/admin/store_credits_spec.rb +0 -93
- data/spec/features/admin/taxons_spec.rb +0 -47
- data/spec/features/admin/users_spec.rb +0 -286
- data/spec/helpers/admin/base_helper_spec.rb +0 -30
- data/spec/helpers/admin/navigation_helper_spec.rb +0 -106
- data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -30
- data/spec/helpers/promotion_rules_helper_spec.rb +0 -12
- data/spec/models/spree/resource_spec.rb +0 -48
- data/spec/routing/admin_path_spec.rb +0 -22
- data/spec/spec_helper.rb +0 -134
- data/spec/support/appear_before_matcher.rb +0 -8
- data/spec/support/ror_ringer.jpeg +0 -0
- data/spec/test_views/spree/admin/submodule/posts/edit.html.erb +0 -1
- data/spec/test_views/spree/admin/submodule/posts/new.html.erb +0 -1
- data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
- data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
@@ -1,147 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Properties", type: :feature, js: true do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
visit spree.admin_products_path
|
8
|
-
end
|
9
|
-
|
10
|
-
context "Property index" do
|
11
|
-
before do
|
12
|
-
create(:property, name: 'shirt size', presentation: 'size')
|
13
|
-
create(:property, name: 'shirt fit', presentation: 'fit')
|
14
|
-
click_link "Products"
|
15
|
-
click_link "Properties"
|
16
|
-
end
|
17
|
-
|
18
|
-
context "listing product properties" do
|
19
|
-
it "should list the existing product properties" do
|
20
|
-
within_row(1) do
|
21
|
-
expect(column_text(1)).to eq("shirt size")
|
22
|
-
expect(column_text(2)).to eq("size")
|
23
|
-
end
|
24
|
-
|
25
|
-
within_row(2) do
|
26
|
-
expect(column_text(1)).to eq("shirt fit")
|
27
|
-
expect(column_text(2)).to eq("fit")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context "searching properties" do
|
33
|
-
it 'should list properties matching search query' do
|
34
|
-
click_on "Filter"
|
35
|
-
fill_in "q_name_cont", with: "size"
|
36
|
-
click_on 'Search'
|
37
|
-
|
38
|
-
expect(page).to have_content("shirt size")
|
39
|
-
expect(page).not_to have_content("shirt fit")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context "creating a property" do
|
45
|
-
it "should allow an admin to create a new product property" do
|
46
|
-
click_link "Products"
|
47
|
-
click_link "Properties"
|
48
|
-
click_link "new_property_link"
|
49
|
-
within('.content-header') { expect(page).to have_content("New Property") }
|
50
|
-
|
51
|
-
fill_in "property_name", with: "color of band"
|
52
|
-
fill_in "property_presentation", with: "color"
|
53
|
-
click_button "Create"
|
54
|
-
expect(page).to have_content("successfully created!")
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
context "editing a property" do
|
59
|
-
before(:each) do
|
60
|
-
create(:property)
|
61
|
-
click_link "Products"
|
62
|
-
click_link "Properties"
|
63
|
-
within_row(1) { click_icon :edit }
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should allow an admin to edit an existing product property" do
|
67
|
-
fill_in "property_name", with: "model 99"
|
68
|
-
click_button "Update"
|
69
|
-
expect(page).to have_content("successfully updated!")
|
70
|
-
expect(page).to have_content("model 99")
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should show validation errors" do
|
74
|
-
fill_in "property_name", with: ""
|
75
|
-
click_button "Update"
|
76
|
-
expect(page).to have_content("Name can't be blank")
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
context "linking a property to a product" do
|
81
|
-
before do
|
82
|
-
create(:product)
|
83
|
-
visit spree.admin_products_path
|
84
|
-
click_icon :edit
|
85
|
-
within('#sidebar') do
|
86
|
-
click_link "Properties"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
# Regression test for #2279
|
91
|
-
it "successfully create and then remove product property" do
|
92
|
-
fill_in_property
|
93
|
-
# Sometimes the page doesn't load before the all check is done
|
94
|
-
# lazily finding the element gives the page 10 seconds
|
95
|
-
expect(page).to have_css("tbody#product_properties tr:nth-child(2)")
|
96
|
-
expect(all("tbody#product_properties tr").count).to eq(2)
|
97
|
-
|
98
|
-
delete_product_property
|
99
|
-
|
100
|
-
check_property_row_count(1)
|
101
|
-
end
|
102
|
-
|
103
|
-
# Regression test for #4466
|
104
|
-
it "successfully remove and create a product property at the same time" do
|
105
|
-
fill_in_property
|
106
|
-
|
107
|
-
fill_in "product_product_properties_attributes_1_property_name", with: "New Property"
|
108
|
-
fill_in "product_product_properties_attributes_1_value", with: "New Value"
|
109
|
-
|
110
|
-
delete_product_property
|
111
|
-
|
112
|
-
# Give fadeOut time to complete
|
113
|
-
expect(page).not_to have_selector("#product_product_properties_attributes_0_property_name")
|
114
|
-
expect(page).not_to have_selector("#product_product_properties_attributes_0_value")
|
115
|
-
|
116
|
-
click_button "Update"
|
117
|
-
|
118
|
-
expect(page).not_to have_content("Product is not found")
|
119
|
-
|
120
|
-
check_property_row_count(2)
|
121
|
-
end
|
122
|
-
|
123
|
-
def fill_in_property
|
124
|
-
fill_in "product_product_properties_attributes_0_property_name", with: "A Property"
|
125
|
-
fill_in "product_product_properties_attributes_0_value", with: "A Value"
|
126
|
-
click_button "Update"
|
127
|
-
within('#sidebar') do
|
128
|
-
click_link "Properties"
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
def delete_product_property
|
133
|
-
accept_alert do
|
134
|
-
click_icon :delete
|
135
|
-
wait_for_ajax # delete action must finish before reloading
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
def check_property_row_count(expected_row_count)
|
140
|
-
within('#sidebar') do
|
141
|
-
click_link "Properties"
|
142
|
-
end
|
143
|
-
expect(page).to have_css("tbody#product_properties")
|
144
|
-
expect(all("tbody#product_properties tr").count).to eq(expected_row_count)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
@@ -1,112 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Prototypes", type: :feature, js: true do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
context "listing prototypes" do
|
7
|
-
it "should be able to list existing prototypes" do
|
8
|
-
create(:property, name: "model", presentation: "Model")
|
9
|
-
create(:property, name: "brand", presentation: "Brand")
|
10
|
-
create(:property, name: "shirt_fabric", presentation: "Fabric")
|
11
|
-
create(:property, name: "shirt_sleeve_length", presentation: "Sleeve")
|
12
|
-
create(:property, name: "mug_type", presentation: "Type")
|
13
|
-
create(:property, name: "bag_type", presentation: "Type")
|
14
|
-
create(:property, name: "manufacturer", presentation: "Manufacturer")
|
15
|
-
create(:property, name: "bag_size", presentation: "Size")
|
16
|
-
create(:property, name: "mug_size", presentation: "Size")
|
17
|
-
create(:property, name: "gender", presentation: "Gender")
|
18
|
-
create(:property, name: "shirt_fit", presentation: "Fit")
|
19
|
-
create(:property, name: "bag_material", presentation: "Material")
|
20
|
-
create(:property, name: "shirt_type", presentation: "Type")
|
21
|
-
p = create(:prototype, name: "Shirt")
|
22
|
-
%w( brand gender manufacturer model shirt_fabric shirt_fit shirt_sleeve_length shirt_type ).each do |prop|
|
23
|
-
p.properties << Spree::Property.find_by_name(prop)
|
24
|
-
end
|
25
|
-
p = create(:prototype, name: "Mug")
|
26
|
-
%w( mug_size mug_type ).each do |prop|
|
27
|
-
p.properties << Spree::Property.find_by_name(prop)
|
28
|
-
end
|
29
|
-
p = create(:prototype, name: "Bag")
|
30
|
-
%w( bag_type bag_material ).each do |prop|
|
31
|
-
p.properties << Spree::Property.find_by_name(prop)
|
32
|
-
end
|
33
|
-
|
34
|
-
visit spree.admin_path
|
35
|
-
click_link "Products"
|
36
|
-
click_link "Prototypes"
|
37
|
-
|
38
|
-
within_row(1) { expect(column_text(1)).to eq "Shirt" }
|
39
|
-
within_row(2) { expect(column_text(1)).to eq "Mug" }
|
40
|
-
within_row(3) { expect(column_text(1)).to eq "Bag" }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context "creating a prototype" do
|
45
|
-
it "should allow an admin to create a new product prototype" do
|
46
|
-
visit spree.admin_path
|
47
|
-
click_link "Products"
|
48
|
-
click_link "Prototypes"
|
49
|
-
|
50
|
-
click_link "new_prototype_link"
|
51
|
-
within('.content-header') do
|
52
|
-
expect(page).to have_content("New Prototype")
|
53
|
-
end
|
54
|
-
fill_in "prototype_name", with: "male shirts"
|
55
|
-
click_button "Create"
|
56
|
-
expect(page).to have_content("successfully created!")
|
57
|
-
click_link "Products"
|
58
|
-
click_link "Prototypes"
|
59
|
-
within_row(1) { click_icon :edit }
|
60
|
-
fill_in "prototype_name", with: "Shirt 99"
|
61
|
-
click_button "Update"
|
62
|
-
expect(page).to have_content("successfully updated!")
|
63
|
-
expect(page).to have_content("Shirt 99")
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
context "editing a prototype" do
|
68
|
-
it "should allow to empty its properties" do
|
69
|
-
model_property = create(:property, name: "model", presentation: "Model")
|
70
|
-
brand_property = create(:property, name: "brand", presentation: "Brand")
|
71
|
-
|
72
|
-
shirt_prototype = create(:prototype, name: "Shirt", properties: [])
|
73
|
-
%w( brand model ).each do |prop|
|
74
|
-
shirt_prototype.properties << Spree::Property.find_by_name(prop)
|
75
|
-
end
|
76
|
-
|
77
|
-
visit spree.admin_path
|
78
|
-
click_link "Products"
|
79
|
-
click_link "Prototypes"
|
80
|
-
|
81
|
-
click_icon :edit
|
82
|
-
property_ids = find_field("prototype_property_ids").value.map(&:to_i)
|
83
|
-
expect(property_ids).to match_array [model_property.id, brand_property.id]
|
84
|
-
|
85
|
-
unselect "Brand", from: "prototype_property_ids"
|
86
|
-
unselect "Model", from: "prototype_property_ids"
|
87
|
-
|
88
|
-
click_button 'Update'
|
89
|
-
|
90
|
-
click_icon :edit
|
91
|
-
|
92
|
-
expect(find_field("prototype_property_ids").value).to be_empty
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'should be deletable' do
|
97
|
-
shirt_prototype = create(:prototype, name: "Shirt", properties: [])
|
98
|
-
shirt_prototype.taxons << create(:taxon)
|
99
|
-
|
100
|
-
visit spree.admin_path
|
101
|
-
click_link "Products"
|
102
|
-
click_link "Prototypes"
|
103
|
-
|
104
|
-
within("#spree_prototype_#{shirt_prototype.id}") do
|
105
|
-
page.find('.delete-resource').click
|
106
|
-
end
|
107
|
-
|
108
|
-
accept_alert do
|
109
|
-
expect(page).to have_content("Prototype \"#{shirt_prototype.name}\" has been successfully removed!")
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
@@ -1,124 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Stock Management", type: :feature, js: true do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
context "given a product with a variant and a stock location" do
|
7
|
-
let!(:stock_location) { create(:stock_location, name: 'Default') }
|
8
|
-
let!(:product) { create(:product, name: 'apache baseball cap', price: 10) }
|
9
|
-
let!(:variant) { product.master }
|
10
|
-
|
11
|
-
before do
|
12
|
-
stock_location.stock_item(variant).update_column(:count_on_hand, 10)
|
13
|
-
visit spree.stock_admin_product_path(product)
|
14
|
-
end
|
15
|
-
|
16
|
-
context "toggle backorderable for a variant's stock item" do
|
17
|
-
let(:backorderable) { find ".stock_item_backorderable" }
|
18
|
-
|
19
|
-
before do
|
20
|
-
expect(backorderable).to be_checked
|
21
|
-
backorderable.set(false)
|
22
|
-
wait_for_ajax
|
23
|
-
end
|
24
|
-
|
25
|
-
it "persists the value when page reload" do
|
26
|
-
visit current_path
|
27
|
-
expect(backorderable).not_to be_checked
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context "toggle track inventory for a variant's stock item" do
|
32
|
-
let(:track_inventory) { find ".track_inventory_checkbox" }
|
33
|
-
|
34
|
-
before do
|
35
|
-
expect(track_inventory).to be_checked
|
36
|
-
track_inventory.set(false)
|
37
|
-
wait_for_ajax
|
38
|
-
end
|
39
|
-
|
40
|
-
it "persists the value when page reloaded" do
|
41
|
-
visit current_path
|
42
|
-
expect(track_inventory).not_to be_checked
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# Regression test for #2896
|
47
|
-
# The regression was that unchecking the last checkbox caused a redirect
|
48
|
-
# to happen. By ensuring that we're still on an /admin/products URL, we
|
49
|
-
# assert that the redirect is *not* happening.
|
50
|
-
it "can toggle backorderable for the second variant stock item" do
|
51
|
-
new_location = create(:stock_location, name: "Another Location")
|
52
|
-
visit current_url
|
53
|
-
|
54
|
-
new_location_backorderable = find "#stock_item_backorderable_#{new_location.id}"
|
55
|
-
new_location_backorderable.set(false)
|
56
|
-
wait_for_ajax
|
57
|
-
|
58
|
-
expect(page.current_url).to include("/admin/products")
|
59
|
-
end
|
60
|
-
|
61
|
-
it "can create a new stock movement" do
|
62
|
-
fill_in "stock_movement_quantity", with: 5
|
63
|
-
select2 "default", from: "Stock Location"
|
64
|
-
click_button "Add Stock"
|
65
|
-
|
66
|
-
expect(page).to have_content('successfully created')
|
67
|
-
|
68
|
-
within(:css, '.stock_location_info table') do
|
69
|
-
expect(column_text(2)).to eq '15'
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
it "can create a new negative stock movement" do
|
74
|
-
fill_in "stock_movement_quantity", with: -5
|
75
|
-
select2 "default", from: "Stock Location"
|
76
|
-
click_button "Add Stock"
|
77
|
-
|
78
|
-
expect(page).to have_content('successfully created')
|
79
|
-
|
80
|
-
within(:css, '.stock_location_info table') do
|
81
|
-
expect(column_text(2)).to eq '5'
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context "with multiple variants" do
|
86
|
-
let!(:variant) { create(:variant, product: product, sku: 'SPREEC') }
|
87
|
-
before do
|
88
|
-
variant.stock_items.first.update_column(:count_on_hand, 30)
|
89
|
-
visit current_url
|
90
|
-
end
|
91
|
-
|
92
|
-
it "can create a new stock movement for the specified variant" do
|
93
|
-
fill_in "stock_movement_quantity", with: 10
|
94
|
-
select2 "SPREEC", from: "Variant"
|
95
|
-
click_button "Add Stock"
|
96
|
-
|
97
|
-
expect(page).to have_content('successfully created')
|
98
|
-
|
99
|
-
within("#listing_product_stock tr", :text => "SPREEC") do
|
100
|
-
within("table") do
|
101
|
-
expect(column_text(2)).to eq '40'
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
# Regression test for #3304
|
108
|
-
context "with no stock location" do
|
109
|
-
let(:product) { create(:product, name: 'apache baseball cap', price: 10) }
|
110
|
-
let(:variant) { create(:variant, product: product, sku: 'FOOBAR') }
|
111
|
-
|
112
|
-
before do
|
113
|
-
Spree::StockLocation.delete_all
|
114
|
-
|
115
|
-
visit spree.stock_admin_product_path(product)
|
116
|
-
end
|
117
|
-
|
118
|
-
it "redirects to stock locations page", js: false do
|
119
|
-
expect(page).to have_content(Spree.t(:stock_management_requires_a_stock_location))
|
120
|
-
expect(page.current_url).to include("admin/stock_locations")
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Taxonomies", type: :feature, js: true do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
visit spree.admin_path
|
8
|
-
click_link "Products"
|
9
|
-
end
|
10
|
-
|
11
|
-
context "show" do
|
12
|
-
it "should display existing taxonomies" do
|
13
|
-
create(:taxonomy, name: 'Brand')
|
14
|
-
create(:taxonomy, name: 'Categories')
|
15
|
-
click_link "Taxonomies"
|
16
|
-
within_row(1) { expect(page).to have_content("Brand") }
|
17
|
-
within_row(2) { expect(page).to have_content("Categories") }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context "create" do
|
22
|
-
before(:each) do
|
23
|
-
click_link "Taxonomies"
|
24
|
-
click_link "admin_new_taxonomy_link"
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should allow an admin to create a new taxonomy" do
|
28
|
-
expect(page).to have_content("New Taxonomy")
|
29
|
-
fill_in "taxonomy_name", with: "sports"
|
30
|
-
click_button "Create"
|
31
|
-
expect(page).to have_content("successfully created!")
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should display validation errors" do
|
35
|
-
fill_in "taxonomy_name", with: ""
|
36
|
-
click_button "Create"
|
37
|
-
expect(page).to have_content("can't be blank")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context "edit" do
|
42
|
-
it "should allow an admin to update an existing taxonomy" do
|
43
|
-
create(:taxonomy)
|
44
|
-
click_link "Taxonomies"
|
45
|
-
within_row(1) { click_icon :edit }
|
46
|
-
fill_in "taxonomy_name", with: "sports 99"
|
47
|
-
click_button "Update"
|
48
|
-
expect(page).to have_content("successfully updated!")
|
49
|
-
expect(page).to have_content("sports 99")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe "Variants", type: :feature do
|
5
|
-
stub_authorization!
|
6
|
-
|
7
|
-
let(:product) { create(:product_with_option_types, price: "1.99", cost_price: "1.00", weight: "2.5", height: "3.0", width: "1.0", depth: "1.5") }
|
8
|
-
|
9
|
-
context "creating a new variant" do
|
10
|
-
it "should allow an admin to create a new variant", js: true do
|
11
|
-
product.options.each do |option|
|
12
|
-
create(:option_value, option_type: option.option_type)
|
13
|
-
end
|
14
|
-
|
15
|
-
visit spree.admin_products_path
|
16
|
-
within_row(1) { click_icon :edit }
|
17
|
-
click_link "Variants"
|
18
|
-
click_on "Add One"
|
19
|
-
expect(find('input#variant_price').value).to eq("1.99")
|
20
|
-
expect(find('input#variant_cost_price').value).to eq("1.00")
|
21
|
-
expect(find('input#variant_weight').value).to eq("2.50")
|
22
|
-
expect(find('input#variant_height').value).to eq("3.00")
|
23
|
-
expect(find('input#variant_width').value).to eq("1.00")
|
24
|
-
expect(find('input#variant_depth').value).to eq("1.50")
|
25
|
-
expect(page).to have_select('variant[tax_category_id]')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context "listing variants" do
|
30
|
-
context "currency displaying" do
|
31
|
-
context "using Russian Rubles" do
|
32
|
-
before do
|
33
|
-
Spree::Config[:currency] = "RUB"
|
34
|
-
end
|
35
|
-
|
36
|
-
let!(:variant) do
|
37
|
-
create(:variant, product: product, price: 19.99)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Regression test for #2737
|
41
|
-
context "uses руб as the currency symbol" do
|
42
|
-
it "on the products listing page" do
|
43
|
-
visit spree.admin_product_variants_path(product)
|
44
|
-
within_row(1) { expect(page).to have_content("19.99 ₽") }
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|