solidus_backend 2.2.2 → 2.3.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend.js +1 -2
- data/app/assets/javascripts/spree/backend/address_states.js +1 -1
- data/app/assets/javascripts/spree/backend/adjustments.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/admin.js +37 -41
- data/app/assets/javascripts/spree/backend/components/editable_table.js.coffee +3 -0
- data/app/assets/javascripts/spree/backend/images/index.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/images/upload.js +13 -189
- data/app/assets/javascripts/spree/backend/models/image_upload.js +76 -0
- data/app/assets/javascripts/spree/backend/models/index.js +2 -0
- data/app/assets/javascripts/spree/backend/models/taxonomy.js +3 -0
- data/app/assets/javascripts/spree/backend/namespaces.js +3 -1
- data/app/assets/javascripts/spree/backend/payments/new.js +8 -36
- data/app/assets/javascripts/spree/backend/promotions.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/select_payments.js.coffee +0 -12
- data/app/assets/javascripts/spree/backend/shipments.js +1 -1
- data/app/assets/javascripts/spree/backend/spree-select2.js +1 -1
- data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +101 -95
- data/app/assets/javascripts/spree/backend/templates/products/upload_progress.hbs +5 -3
- data/app/assets/javascripts/spree/backend/views/images/upload_progress.js +48 -0
- data/app/assets/javascripts/spree/backend/views/images/upload_zone.js +39 -0
- data/app/assets/javascripts/spree/backend/views/index.js +6 -0
- data/app/assets/javascripts/spree/backend/views/order/address.js +1 -5
- data/app/assets/javascripts/spree/backend/views/payment/edit_credit_card.js +23 -0
- data/app/assets/javascripts/spree/backend/views/payment/new.js +25 -0
- data/app/assets/javascripts/spree/backend/views/state_select.js +4 -4
- data/app/assets/javascripts/spree/backend/views/tables/editable_table.js.coffee +14 -0
- data/app/assets/javascripts/spree/backend/views/tables/editable_table_row.js.coffee +45 -0
- data/app/assets/stylesheets/spree/backend/components/_date-picker.scss +0 -1
- data/app/assets/stylesheets/spree/backend/components/_editable_table.scss +37 -0
- data/app/assets/stylesheets/spree/backend/plugins/_bootstrap_tooltip.scss +2 -2
- data/app/assets/stylesheets/spree/backend/sections/_products.scss +0 -8
- data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +15 -9
- data/app/assets/stylesheets/spree/backend/shared/_icons.scss +14 -14
- data/app/assets/stylesheets/spree/backend/shared/_tables.scss +1 -2
- data/app/assets/stylesheets/spree/backend/shared/_utilities.scss +13 -0
- data/app/assets/stylesheets/spree/backend/spree_admin.scss +1 -1
- data/app/controllers/spree/admin/cancellations_controller.rb +1 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
- data/app/controllers/spree/admin/orders_controller.rb +3 -10
- data/app/controllers/spree/admin/payment_methods_controller.rb +19 -6
- data/app/controllers/spree/admin/payments_controller.rb +2 -2
- data/app/controllers/spree/admin/products_controller.rb +3 -9
- data/app/controllers/spree/admin/promotion_rules_controller.rb +5 -1
- data/app/controllers/spree/admin/promotions_controller.rb +1 -1
- data/app/controllers/spree/admin/properties_controller.rb +1 -1
- data/app/controllers/spree/admin/reports_controller.rb +24 -21
- data/app/controllers/spree/admin/resource_controller.rb +25 -14
- data/app/controllers/spree/admin/style_guide_controller.rb +4 -0
- data/app/controllers/spree/admin/users_controller.rb +1 -1
- data/app/controllers/spree/admin/variants_controller.rb +5 -0
- data/app/helpers/spree/admin/navigation_helper.rb +6 -2
- data/app/helpers/spree/promotion_rules_helper.rb +2 -2
- data/app/models/spree/backend_configuration.rb +1 -0
- data/app/views/spree/admin/adjustments/_form.html.erb +1 -1
- data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +2 -2
- data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
- data/app/views/spree/admin/images/_form.html.erb +1 -1
- data/app/views/spree/admin/images/_image_row.html.erb +22 -4
- data/app/views/spree/admin/images/create.js.erb +8 -5
- data/app/views/spree/admin/images/index.html.erb +4 -8
- data/app/views/spree/admin/orders/_risk_analysis.html.erb +6 -7
- data/app/views/spree/admin/orders/_shipment.html.erb +1 -1
- data/app/views/spree/admin/orders/confirm/_customer_details.html.erb +1 -1
- data/app/views/spree/admin/orders/confirm/_payments.html.erb +1 -1
- data/app/views/spree/admin/orders/index.html.erb +3 -3
- data/app/views/spree/admin/payment_methods/_form.html.erb +5 -5
- data/app/views/spree/admin/payments/_form.html.erb +2 -2
- data/app/views/spree/admin/payments/_list.html.erb +1 -1
- data/app/views/spree/admin/payments/show.html.erb +1 -1
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +2 -7
- data/app/views/spree/admin/prices/_form.html.erb +2 -2
- data/app/views/spree/admin/prices/edit.html.erb +2 -0
- data/app/views/spree/admin/prices/index.html.erb +5 -4
- data/app/views/spree/admin/prices/new.html.erb +4 -0
- data/app/views/spree/admin/product_properties/index.html.erb +1 -1
- data/app/views/spree/admin/products/_form.html.erb +4 -3
- data/app/views/spree/admin/products/index.html.erb +3 -3
- data/app/views/spree/admin/products/new.html.erb +2 -2
- data/app/views/spree/admin/products/new.js.erb +0 -3
- data/app/views/spree/admin/promotion_actions/create.js.erb +2 -6
- data/app/views/spree/admin/promotion_rules/create.js.erb +0 -8
- data/app/views/spree/admin/promotions/_actions.html.erb +2 -2
- data/app/views/spree/admin/promotions/_form.html.erb +1 -1
- data/app/views/spree/admin/promotions/_promotion_action.html.erb +3 -4
- data/app/views/spree/admin/promotions/_promotion_rule.html.erb +3 -3
- data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
- data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +6 -2
- data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +1 -1
- data/app/views/spree/admin/promotions/calculators/distributed_amount/_fields.html.erb +54 -0
- data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +33 -14
- data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +33 -14
- data/app/views/spree/admin/promotions/index.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_first_repeat_purchase_since.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_item_total.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_landing_page.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_nth_order.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_product.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_taxon.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_user_role.html.erb +2 -2
- data/app/views/spree/admin/refunds/edit.html.erb +1 -1
- data/app/views/spree/admin/refunds/new.html.erb +1 -1
- data/app/views/spree/admin/reimbursements/edit.html.erb +2 -2
- data/app/views/spree/admin/reports/sales_total.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +4 -4
- data/app/views/spree/admin/shared/_address_form.html.erb +2 -2
- data/app/views/spree/admin/shared/_calculator_fields.html.erb +1 -1
- data/app/views/spree/admin/shared/_product_tabs.html.erb +4 -4
- data/app/views/spree/admin/shared/_report_order_criteria.html.erb +1 -1
- data/app/views/spree/admin/shared/_variant_search.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/_form.html.erb +1 -1
- data/app/views/spree/admin/states/index.html.erb +1 -1
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/_form.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/edit.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/index.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/new.html.erb +1 -1
- data/app/views/spree/admin/store_credits/_form.html.erb +1 -1
- data/app/views/spree/admin/store_credits/_update_reason_field.html.erb +1 -1
- data/app/views/spree/admin/stores/_form.html.erb +1 -1
- data/app/views/spree/admin/style_guide/topics/forms/_building_forms.html.erb +4 -8
- data/app/views/spree/admin/style_guide/topics/forms/_buttons.html.erb +6 -0
- data/app/views/spree/admin/style_guide/topics/forms/_helper_text.html.erb +13 -0
- data/app/views/spree/admin/style_guide/topics/forms/_inputs.html.erb +96 -0
- data/app/views/spree/admin/style_guide/topics/forms/_labels.html.erb +6 -0
- data/app/views/spree/admin/style_guide/topics/forms/_validation.html.erb +8 -1
- data/app/views/spree/admin/style_guide/topics/layout/_full_width_table_layout.html.erb +10 -0
- data/app/views/spree/admin/style_guide/topics/layout/_helpful_layout.html.erb +0 -0
- data/app/views/spree/admin/style_guide/topics/layout/_sidebar_layout.html.erb +4 -0
- data/app/views/spree/admin/style_guide/topics/messaging/_flashes.html.erb +10 -4
- data/app/views/spree/admin/style_guide/topics/messaging/_tooltips.html.erb +45 -0
- data/app/views/spree/admin/style_guide/topics/tables/_forms_in_tables.html.erb +4 -0
- data/app/views/spree/admin/style_guide/topics/typography/_lists.html.erb +1 -1
- data/app/views/spree/admin/tax_rates/_form.html.erb +17 -3
- data/app/views/spree/admin/tax_rates/index.html.erb +12 -3
- data/app/views/spree/admin/taxonomies/edit.erb +1 -8
- data/app/views/spree/admin/taxons/_form.html.erb +6 -4
- data/app/views/spree/admin/taxons/edit.html.erb +0 -15
- data/app/views/spree/admin/taxons/index.html.erb +1 -1
- data/app/views/spree/admin/variants/_form.html.erb +8 -9
- data/app/views/spree/admin/variants/new.js.erb +0 -1
- data/config/routes.rb +1 -1
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/orders_controller_spec.rb +16 -4
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/payments_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/products_controller_spec.rb +33 -0
- data/spec/controllers/spree/admin/variants_controller_spec.rb +39 -13
- data/spec/features/admin/configuration/payment_methods_spec.rb +11 -11
- data/spec/features/admin/configuration/shipping_methods_spec.rb +1 -1
- data/spec/features/admin/configuration/states_spec.rb +4 -4
- data/spec/features/admin/configuration/store_spec.rb +3 -3
- data/spec/features/admin/configuration/tax_rates_spec.rb +1 -1
- data/spec/features/admin/orders/adjustments_spec.rb +1 -1
- data/spec/features/admin/orders/customer_details_spec.rb +10 -11
- data/spec/features/admin/orders/listing_spec.rb +1 -1
- data/spec/features/admin/orders/new_order_spec.rb +4 -11
- data/spec/features/admin/orders/order_details_spec.rb +20 -30
- data/spec/features/admin/orders/return_payment_state_spec.rb +60 -0
- data/spec/features/admin/orders/shipments_spec.rb +7 -0
- data/spec/features/admin/products/edit/images_spec.rb +48 -9
- data/spec/features/admin/products/edit/variants_spec.rb +1 -1
- data/spec/features/admin/products/option_types_spec.rb +2 -2
- data/spec/features/admin/products/products_spec.rb +49 -3
- data/spec/features/admin/products/stock_management_spec.rb +1 -3
- data/spec/features/admin/products/variant_spec.rb +20 -0
- data/spec/features/admin/promotion_adjustments_spec.rb +35 -34
- data/spec/features/admin/promotions/option_value_rule_spec.rb +2 -2
- data/spec/features/admin/promotions/product_rule_spec.rb +1 -1
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +2 -2
- data/spec/features/admin/promotions/user_rule_spec.rb +2 -2
- data/spec/features/admin/stock_transfer_spec.rb +11 -8
- data/spec/helpers/admin/navigation_helper_spec.rb +23 -0
- metadata +26 -18
- data/app/assets/javascripts/spree/backend/images/new.js.coffee +0 -7
- data/app/assets/stylesheets/spree/backend/sections/_payments.scss +0 -14
- data/app/helpers/spree/admin/images_helper.rb +0 -17
- data/app/views/spree/admin/orders/_add_line_item.html.erb +0 -15
- data/app/views/spree/admin/prices/new.js.erb +0 -2
- data/app/views/spree/admin/products/_properties_form.erb +0 -10
- data/app/views/spree/admin/promotions/_tab.html.erb +0 -1
- data/app/views/spree/admin/shared/_report_criteria.html.erb +0 -17
- data/app/views/spree/admin/states/_new.html.erb +0 -7
- data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +0 -38
- data/app/views/spree/admin/stock_transfers/_stock_movements.html.erb +0 -27
- data/app/views/spree/admin/taxons/_taxon_table.html.erb +0 -23
|
@@ -46,7 +46,7 @@ describe "Product Variants", type: :feature do
|
|
|
46
46
|
within('nav > ul.tabs') { click_link "Variants" }
|
|
47
47
|
click_link "New Variant"
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
select "black", from: "Colors"
|
|
50
50
|
fill_in "variant_sku", with: "A100"
|
|
51
51
|
click_button "Create"
|
|
52
52
|
expect(page).to have_content("successfully created!")
|
|
@@ -58,10 +58,10 @@ describe "Option Types", type: :feature do
|
|
|
58
58
|
|
|
59
59
|
# Regression test for https://github.com/spree/spree/issues/2277
|
|
60
60
|
it "can remove an option value from an option type", js: true do
|
|
61
|
-
create(:option_value)
|
|
61
|
+
option_value = create(:option_value)
|
|
62
62
|
click_link "Option Types"
|
|
63
63
|
within('table#listing_option_types') { click_icon :edit }
|
|
64
|
-
expect(page).to
|
|
64
|
+
expect(page).to have_title("#{option_value.option_type.name} - Option Types - Products")
|
|
65
65
|
expect(page).to have_css("tbody#option_values tr", count: 1)
|
|
66
66
|
within("tbody#option_values") do
|
|
67
67
|
find('.spree_remove_fields').click
|
|
@@ -69,6 +69,23 @@ describe "Products", type: :feature do
|
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
|
+
context "when none of the product prices are in the same currency as the default in the store" do
|
|
73
|
+
before do
|
|
74
|
+
Spree::Config[:currency] = "MXN"
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
let!(:product) do
|
|
78
|
+
create(:product, name: "Just a product", price: 19.99)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it 'defaults it to Spree::Config.currency and sets the price as blank' do
|
|
82
|
+
Spree::Config[:currency] = "USD"
|
|
83
|
+
visit spree.admin_product_path(product)
|
|
84
|
+
within("#product_price_field") do
|
|
85
|
+
expect(page).to have_content("USD")
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
72
89
|
end
|
|
73
90
|
|
|
74
91
|
context "searching products" do
|
|
@@ -81,6 +98,7 @@ describe "Products", type: :feature do
|
|
|
81
98
|
expect(page).not_to have_content("apache baseball cap")
|
|
82
99
|
check "Show Deleted"
|
|
83
100
|
click_button 'Search'
|
|
101
|
+
expect(find('input[name="q[with_deleted]"]')).to be_checked
|
|
84
102
|
expect(page).to have_content("zomg shirt")
|
|
85
103
|
expect(page).to have_content("apache baseball cap")
|
|
86
104
|
uncheck "Show Deleted"
|
|
@@ -95,18 +113,43 @@ describe "Products", type: :feature do
|
|
|
95
113
|
create(:product, name: 'zomg shirt')
|
|
96
114
|
|
|
97
115
|
click_nav "Products"
|
|
98
|
-
fill_in "
|
|
116
|
+
fill_in "Name", with: "ap"
|
|
99
117
|
click_button 'Search'
|
|
100
118
|
expect(page).to have_content("apache baseball cap")
|
|
101
119
|
expect(page).to have_content("apache baseball cap2")
|
|
102
120
|
expect(page).not_to have_content("zomg shirt")
|
|
103
121
|
|
|
104
|
-
fill_in "
|
|
122
|
+
fill_in "SKU", with: "A1"
|
|
105
123
|
click_button "Search"
|
|
106
124
|
expect(page).to have_content("apache baseball cap")
|
|
107
125
|
expect(page).not_to have_content("apache baseball cap2")
|
|
108
126
|
expect(page).not_to have_content("zomg shirt")
|
|
109
127
|
end
|
|
128
|
+
|
|
129
|
+
# Regression test for https://github.com/solidusio/solidus/issues/2016
|
|
130
|
+
it "should be able to search and sort by price" do
|
|
131
|
+
product = create(:product, name: 'apache baseball cap', sku: "A001")
|
|
132
|
+
create(:variant, product: product, sku: "A002")
|
|
133
|
+
create(:product, name: 'zomg shirt', sku: "Z001")
|
|
134
|
+
|
|
135
|
+
click_nav "Products"
|
|
136
|
+
expect(page).to have_content("apache baseball cap")
|
|
137
|
+
expect(page).to have_content("zomg shirt")
|
|
138
|
+
expect(page).to have_css('#listing_products > tbody > tr', count: 2)
|
|
139
|
+
|
|
140
|
+
fill_in "SKU", with: "A"
|
|
141
|
+
click_button 'Search'
|
|
142
|
+
expect(page).to have_content("apache baseball cap")
|
|
143
|
+
expect(page).not_to have_content("zomg shirt")
|
|
144
|
+
expect(page).to have_css('#listing_products > tbody > tr', count: 1)
|
|
145
|
+
|
|
146
|
+
# Sort by master price
|
|
147
|
+
click_on 'Master Price'
|
|
148
|
+
expect(page).to have_css('.sort_link.asc', text: 'Master Price')
|
|
149
|
+
expect(page).to have_content("apache baseball cap")
|
|
150
|
+
expect(page).not_to have_content("zomg shirt")
|
|
151
|
+
expect(page).to have_css('#listing_products > tbody > tr', count: 1)
|
|
152
|
+
end
|
|
110
153
|
end
|
|
111
154
|
|
|
112
155
|
context "creating a new product" do
|
|
@@ -234,7 +277,7 @@ describe "Products", type: :feature do
|
|
|
234
277
|
context 'deleting a product', js: true do
|
|
235
278
|
let!(:product) { create(:product) }
|
|
236
279
|
|
|
237
|
-
it "
|
|
280
|
+
it "product details are still viewable" do
|
|
238
281
|
visit spree.admin_products_path
|
|
239
282
|
|
|
240
283
|
expect(page).to have_content(product.name)
|
|
@@ -249,6 +292,9 @@ describe "Products", type: :feature do
|
|
|
249
292
|
click_button "Search"
|
|
250
293
|
click_link product.name
|
|
251
294
|
expect(page).to have_field('Master Price', with: product.price.to_f)
|
|
295
|
+
expect(page).to_not have_content('Images')
|
|
296
|
+
expect(page).to_not have_content('Prices')
|
|
297
|
+
expect(page).to_not have_content('Product Properties')
|
|
252
298
|
end
|
|
253
299
|
end
|
|
254
300
|
end
|
|
@@ -25,8 +25,6 @@ describe "Product Stock", type: :feature do
|
|
|
25
25
|
# It is OK to still render the stock page, ensure no errors in this case
|
|
26
26
|
context "with no stock location" do
|
|
27
27
|
before do
|
|
28
|
-
@product = create(:product, name: 'apache baseball cap', price: 10)
|
|
29
|
-
@product.variants.create!(sku: 'FOOBAR')
|
|
30
28
|
Spree::StockLocation.destroy_all
|
|
31
29
|
find_by_id('content-header').click_link('Products')
|
|
32
30
|
within_row(1) do
|
|
@@ -77,7 +75,7 @@ describe "Product Stock", type: :feature do
|
|
|
77
75
|
visit current_url
|
|
78
76
|
within('.variant-stock-items', text: variant.sku) do
|
|
79
77
|
fill_in "variant-count-on-hand-#{variant.id}", with: '3'
|
|
80
|
-
|
|
78
|
+
select "Other location", from: "stock_location_id"
|
|
81
79
|
click_icon(:plus)
|
|
82
80
|
end
|
|
83
81
|
expect(page).to have_content('Created successfully')
|
|
@@ -48,4 +48,24 @@ describe "Variants", type: :feature do
|
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
|
+
|
|
52
|
+
context "editing existent variant" do
|
|
53
|
+
let!(:variant) { create(:variant, product: product) }
|
|
54
|
+
|
|
55
|
+
context "if product has an option type" do
|
|
56
|
+
let!(:option_type) { create(:option_type) }
|
|
57
|
+
let!(:option_value) { create(:option_value, option_type: option_type) }
|
|
58
|
+
|
|
59
|
+
before do
|
|
60
|
+
product.option_types << option_type
|
|
61
|
+
variant.option_values << option_value
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "page has a field for editing the option value", js: true do
|
|
65
|
+
visit spree.edit_admin_product_variant_path(product, variant)
|
|
66
|
+
expect(page).to have_css("label", text: option_type.presentation)
|
|
67
|
+
expect(page).to have_select('Size', selected: 'S')
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
51
71
|
end
|
|
@@ -8,6 +8,7 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
|
8
8
|
visit spree.admin_path
|
|
9
9
|
click_link "Promotions"
|
|
10
10
|
click_link "New Promotion"
|
|
11
|
+
expect(page).to have_title("New Promotion - Promotions")
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
it "should allow an admin to create a flat rate discount coupon promo" do
|
|
@@ -15,23 +16,23 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
|
15
16
|
fill_in "Promotion Code", with: "order"
|
|
16
17
|
|
|
17
18
|
click_button "Create"
|
|
18
|
-
expect(page).to
|
|
19
|
+
expect(page).to have_title("Promotion - Promotions")
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
select "Item total", from: "Add rule of type"
|
|
21
22
|
within('#rule_fields') { click_button "Add" }
|
|
22
23
|
|
|
23
24
|
find('[id$=_preferred_amount]').set(30)
|
|
24
25
|
within('#rule_fields') { click_button "Update" }
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
select "Create whole-order adjustment", from: "Add action of type"
|
|
27
28
|
within('#action_fields') { click_button "Add" }
|
|
28
|
-
|
|
29
|
+
select "Flat Rate", from: "Base Calculator"
|
|
29
30
|
within('#actions_container') { click_button "Update" }
|
|
30
31
|
|
|
31
32
|
within('.calculator-fields') { fill_in "Amount", with: 5 }
|
|
32
33
|
within('#actions_container') { click_button "Update" }
|
|
33
34
|
|
|
34
|
-
promotion = Spree::Promotion.
|
|
35
|
+
promotion = Spree::Promotion.find_by(name: "Promotion")
|
|
35
36
|
expect(promotion.codes.first.value).to eq("order")
|
|
36
37
|
|
|
37
38
|
first_rule = promotion.rules.first
|
|
@@ -51,16 +52,16 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
|
51
52
|
fill_in "Promotion Code", with: "single_use"
|
|
52
53
|
|
|
53
54
|
click_button "Create"
|
|
54
|
-
expect(page).to
|
|
55
|
+
expect(page).to have_title("Promotion - Promotions")
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
select "Create whole-order adjustment", from: "Add action of type"
|
|
57
58
|
within('#action_fields') { click_button "Add" }
|
|
58
|
-
|
|
59
|
+
select "Flat Rate", from: "Base Calculator"
|
|
59
60
|
within('#actions_container') { click_button "Update" }
|
|
60
61
|
within('#action_fields') { fill_in "Amount", with: "5" }
|
|
61
62
|
within('#actions_container') { click_button "Update" }
|
|
62
63
|
|
|
63
|
-
promotion = Spree::Promotion.
|
|
64
|
+
promotion = Spree::Promotion.find_by(name: "Promotion")
|
|
64
65
|
expect(promotion.usage_limit).to eq(1)
|
|
65
66
|
expect(promotion.codes.first.value).to eq("single_use")
|
|
66
67
|
|
|
@@ -75,22 +76,22 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
|
75
76
|
fill_in "Name", with: "Promotion"
|
|
76
77
|
choose "Apply to all orders"
|
|
77
78
|
click_button "Create"
|
|
78
|
-
expect(page).to
|
|
79
|
+
expect(page).to have_title("Promotion - Promotions")
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
select "Item total", from: "Add rule of type"
|
|
81
82
|
within('#rule_fields') { click_button "Add" }
|
|
82
83
|
|
|
83
84
|
find('[id$=_preferred_amount]').set(30)
|
|
84
85
|
within('#rule_fields') { click_button "Update" }
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
select "Create whole-order adjustment", from: "Add action of type"
|
|
87
88
|
within('#action_fields') { click_button "Add" }
|
|
88
|
-
|
|
89
|
+
select "Flat Percent", from: "Base Calculator"
|
|
89
90
|
within('#actions_container') { click_button "Update" }
|
|
90
91
|
within('.calculator-fields') { fill_in "Flat Percent", with: "10" }
|
|
91
92
|
within('#actions_container') { click_button "Update" }
|
|
92
93
|
|
|
93
|
-
promotion = Spree::Promotion.
|
|
94
|
+
promotion = Spree::Promotion.find_by(name: "Promotion")
|
|
94
95
|
expect(promotion.codes.first).to be_nil
|
|
95
96
|
|
|
96
97
|
first_rule = promotion.rules.first
|
|
@@ -110,21 +111,21 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
|
110
111
|
fill_in "Name", with: "Promotion"
|
|
111
112
|
choose "Apply to all orders"
|
|
112
113
|
click_button "Create"
|
|
113
|
-
expect(page).to
|
|
114
|
+
expect(page).to have_title("Promotion - Promotions")
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
select "Product(s)", from: "Add rule of type"
|
|
116
117
|
within("#rule_fields") { click_button "Add" }
|
|
117
118
|
select2_search "RoR Mug", from: "Choose products"
|
|
118
119
|
within('#rule_fields') { click_button "Update" }
|
|
119
120
|
|
|
120
|
-
|
|
121
|
+
select "Create per-line-item adjustment", from: "Add action of type"
|
|
121
122
|
within('#action_fields') { click_button "Add" }
|
|
122
|
-
|
|
123
|
+
select "Percent Per Item", from: "Base Calculator"
|
|
123
124
|
within('#actions_container') { click_button "Update" }
|
|
124
125
|
within('.calculator-fields') { fill_in "Percent", with: "10" }
|
|
125
126
|
within('#actions_container') { click_button "Update" }
|
|
126
127
|
|
|
127
|
-
promotion = Spree::Promotion.
|
|
128
|
+
promotion = Spree::Promotion.find_by(name: "Promotion")
|
|
128
129
|
expect(promotion.codes.first).to be_nil
|
|
129
130
|
|
|
130
131
|
first_rule = promotion.rules.first
|
|
@@ -142,18 +143,18 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
|
142
143
|
fill_in "Name", with: "Promotion"
|
|
143
144
|
choose "Apply to all orders"
|
|
144
145
|
click_button "Create"
|
|
145
|
-
expect(page).to
|
|
146
|
+
expect(page).to have_title("Promotion - Promotions")
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
select "Item total", from: "Add rule of type"
|
|
148
149
|
within('#rule_fields') { click_button "Add" }
|
|
149
150
|
find('[id$=_preferred_amount]').set(30)
|
|
150
151
|
within('#rule_fields') { click_button "Update" }
|
|
151
152
|
|
|
152
|
-
|
|
153
|
+
select "Free shipping", from: "Add action of type"
|
|
153
154
|
within('#action_fields') { click_button "Add" }
|
|
154
155
|
expect(page).to have_content('Makes all shipments for the order free')
|
|
155
156
|
|
|
156
|
-
promotion = Spree::Promotion.
|
|
157
|
+
promotion = Spree::Promotion.find_by(name: "Promotion")
|
|
157
158
|
expect(promotion.codes).to be_empty
|
|
158
159
|
expect(promotion.rules.first).to be_a(Spree::Promotion::Rules::ItemTotal)
|
|
159
160
|
expect(promotion.actions.first).to be_a(Spree::Promotion::Actions::FreeShipping)
|
|
@@ -163,9 +164,9 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
|
163
164
|
fill_in "Name", with: "Promotion"
|
|
164
165
|
choose "Apply to all orders"
|
|
165
166
|
click_button "Create"
|
|
166
|
-
expect(page).to
|
|
167
|
+
expect(page).to have_title("Promotion - Promotions")
|
|
167
168
|
|
|
168
|
-
promotion = Spree::Promotion.
|
|
169
|
+
promotion = Spree::Promotion.find_by(name: "Promotion")
|
|
169
170
|
expect(promotion).to be_apply_automatically
|
|
170
171
|
expect(promotion.path).to be_nil
|
|
171
172
|
expect(promotion.codes).to be_empty
|
|
@@ -177,9 +178,9 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
|
177
178
|
choose "URL Path"
|
|
178
179
|
fill_in "Path", with: "content/cvv"
|
|
179
180
|
click_button "Create"
|
|
180
|
-
expect(page).to
|
|
181
|
+
expect(page).to have_title("Promotion - Promotions")
|
|
181
182
|
|
|
182
|
-
promotion = Spree::Promotion.
|
|
183
|
+
promotion = Spree::Promotion.find_by(name: "Promotion")
|
|
183
184
|
expect(promotion.path).to eq("content/cvv")
|
|
184
185
|
expect(promotion).not_to be_apply_automatically
|
|
185
186
|
expect(promotion.codes).to be_empty
|
|
@@ -192,9 +193,9 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
|
192
193
|
fill_in "Base code", with: "testing"
|
|
193
194
|
fill_in "Number of codes", with: "10"
|
|
194
195
|
click_button "Create"
|
|
195
|
-
expect(page).to
|
|
196
|
+
expect(page).to have_title("Promotion - Promotions")
|
|
196
197
|
|
|
197
|
-
promotion = Spree::Promotion.
|
|
198
|
+
promotion = Spree::Promotion.find_by(name: "Promotion")
|
|
198
199
|
expect(promotion.path).to be_nil
|
|
199
200
|
expect(promotion).not_to be_apply_automatically
|
|
200
201
|
expect(promotion.rules).to be_blank
|
|
@@ -206,21 +207,21 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
|
206
207
|
fill_in "Name", with: "Promotion"
|
|
207
208
|
choose "Apply to all orders"
|
|
208
209
|
click_button "Create"
|
|
209
|
-
expect(page).to
|
|
210
|
+
expect(page).to have_title("Promotion - Promotions")
|
|
210
211
|
|
|
211
|
-
|
|
212
|
+
select "Item total", from: "Add rule of type"
|
|
212
213
|
within('#rule_fields') { click_button "Add" }
|
|
213
214
|
find('[id$=_preferred_amount]').set(50)
|
|
214
215
|
within('#rule_fields') { click_button "Update" }
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
select "Create whole-order adjustment", from: "Add action of type"
|
|
217
218
|
within('#action_fields') { click_button "Add" }
|
|
218
|
-
|
|
219
|
+
select "Flat Rate", from: "Base Calculator"
|
|
219
220
|
within('#actions_container') { click_button "Update" }
|
|
220
221
|
within('.calculator-fields') { fill_in "Amount", with: "5" }
|
|
221
222
|
within('#actions_container') { click_button "Update" }
|
|
222
223
|
|
|
223
|
-
promotion = Spree::Promotion.
|
|
224
|
+
promotion = Spree::Promotion.find_by(name: "Promotion")
|
|
224
225
|
|
|
225
226
|
first_rule = promotion.rules.first
|
|
226
227
|
expect(first_rule.class).to eq(Spree::Promotion::Rules::ItemTotal)
|
|
@@ -14,7 +14,7 @@ feature 'Promotion with option value rule' do
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
scenario "adding an option value rule", js: true do
|
|
17
|
-
|
|
17
|
+
select "Option Value(s)", from: "Add rule of type"
|
|
18
18
|
within("#rules_container") { click_button "Add" }
|
|
19
19
|
|
|
20
20
|
within("#rules_container .promotion-block") do
|
|
@@ -42,7 +42,7 @@ feature 'Promotion with option value rule' do
|
|
|
42
42
|
option_value.update!(name: xss_string)
|
|
43
43
|
end
|
|
44
44
|
scenario "adding an option value rule", js: true do
|
|
45
|
-
|
|
45
|
+
select "Option Value(s)", from: "Add rule of type"
|
|
46
46
|
within("#rules_container") { click_button "Add" }
|
|
47
47
|
|
|
48
48
|
within("#rules_container .promotion-block") do
|
|
@@ -10,7 +10,7 @@ feature 'Promotion with product rule', js: true do
|
|
|
10
10
|
given(:promotion) { create :promotion }
|
|
11
11
|
|
|
12
12
|
def add_promotion_rule_of_type(type)
|
|
13
|
-
|
|
13
|
+
select type, from: "Add rule of type"
|
|
14
14
|
within("#rules_container") { click_button "Add" }
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -10,10 +10,10 @@ feature "Tiered Calculator Promotions" do
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
scenario "adding a tiered percent calculator", js: true do
|
|
13
|
-
|
|
13
|
+
select "Create whole-order adjustment", from: "Add action of type"
|
|
14
14
|
within('#action_fields') { click_button "Add" }
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
select "Tiered Percent", from: "Base Calculator"
|
|
17
17
|
within('#actions_container') { click_button "Update" }
|
|
18
18
|
|
|
19
19
|
within("#actions_container .settings") do
|
|
@@ -14,7 +14,7 @@ feature 'Promotion with user rule', js: true do
|
|
|
14
14
|
let!(:other_user) { create(:user, email: 'bar@example.com') }
|
|
15
15
|
|
|
16
16
|
scenario "searching a user" do
|
|
17
|
-
|
|
17
|
+
select "User", from: "Add rule of type"
|
|
18
18
|
within("#rules_container") { click_button "Add" }
|
|
19
19
|
|
|
20
20
|
select2_search "foo", from: "Choose users", select: false
|
|
@@ -29,7 +29,7 @@ feature 'Promotion with user rule', js: true do
|
|
|
29
29
|
given!(:user) { create(:user, email: xss_string) }
|
|
30
30
|
|
|
31
31
|
scenario "adding an option value rule" do
|
|
32
|
-
|
|
32
|
+
select "User", from: "Add rule of type"
|
|
33
33
|
within("#rules_container") { click_button "Add" }
|
|
34
34
|
|
|
35
35
|
select2_search "<script>", from: "Choose users"
|
|
@@ -16,19 +16,19 @@ describe 'Stock Transfers', type: :feature, js: true do
|
|
|
16
16
|
create(:stock_location, name: 'SF')
|
|
17
17
|
|
|
18
18
|
visit spree.new_admin_stock_transfer_path
|
|
19
|
-
select "SF", from: '
|
|
20
|
-
fill_in '
|
|
19
|
+
select "SF", from: 'Source Location'
|
|
20
|
+
fill_in 'Description', with: description
|
|
21
21
|
click_button 'Continue'
|
|
22
22
|
|
|
23
23
|
expect(page).to have_field('stock_transfer_description', with: description)
|
|
24
24
|
|
|
25
|
-
select "NY", from: '
|
|
25
|
+
select "NY", from: 'Destination Location'
|
|
26
26
|
within "form.edit_stock_transfer" do
|
|
27
27
|
page.find('button').trigger('click')
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
expect(page).to have_content('Stock Transfer has been successfully updated')
|
|
31
|
-
expect(page).to
|
|
31
|
+
expect(page).to have_select("Destination Location", selected: 'NY')
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
# Regression spec for Solidus issue #1087
|
|
@@ -36,7 +36,7 @@ describe 'Stock Transfers', type: :feature, js: true do
|
|
|
36
36
|
create(:stock_location_with_items, name: 'NY')
|
|
37
37
|
create(:stock_location, name: 'SF')
|
|
38
38
|
visit spree.new_admin_stock_transfer_path
|
|
39
|
-
fill_in '
|
|
39
|
+
fill_in 'Description', with: description
|
|
40
40
|
click_button 'Continue'
|
|
41
41
|
|
|
42
42
|
expect(page).to have_content("Source location can't be blank")
|
|
@@ -65,8 +65,8 @@ describe 'Stock Transfers', type: :feature, js: true do
|
|
|
65
65
|
let(:stock_transfer) { create(:stock_transfer_with_items) }
|
|
66
66
|
|
|
67
67
|
before do
|
|
68
|
-
stock_transfer.transfer_items do |item|
|
|
69
|
-
item.update_attributes(expected_quantity: 1)
|
|
68
|
+
stock_transfer.transfer_items.each do |item|
|
|
69
|
+
item.update_attributes!(expected_quantity: 1)
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
@@ -85,7 +85,10 @@ describe 'Stock Transfers', type: :feature, js: true do
|
|
|
85
85
|
describe 'with enough stock' do
|
|
86
86
|
it 'ships stock transfer' do
|
|
87
87
|
visit spree.tracking_info_admin_stock_transfer_path(stock_transfer)
|
|
88
|
-
|
|
88
|
+
|
|
89
|
+
accept_confirm Spree.t('ship_stock_transfer.confirm') do
|
|
90
|
+
click_on 'Ship'
|
|
91
|
+
end
|
|
89
92
|
|
|
90
93
|
expect(page).to have_current_path(spree.admin_stock_transfers_path)
|
|
91
94
|
expect(stock_transfer.reload.shipped_at).to_not be_nil
|