solidus_backend 1.0.7 → 1.1.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_backend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend.js +3 -0
- data/app/assets/javascripts/spree/backend/admin.js.erb +17 -24
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +3 -5
- data/app/assets/javascripts/spree/backend/flash.coffee +17 -0
- data/app/assets/javascripts/spree/backend/handlebars_extensions.coffee +9 -0
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
- data/app/assets/javascripts/spree/backend/option_value_picker.js +43 -0
- data/app/assets/javascripts/spree/backend/product_picker.js +10 -8
- data/app/assets/javascripts/spree/backend/promotions.js.coffee +101 -0
- data/app/assets/javascripts/spree/backend/routes.js +2 -1
- data/app/assets/javascripts/spree/backend/shipments.js.erb +1 -1
- data/app/assets/javascripts/spree/backend/stock_management/index_add_forms.coffee +1 -1
- data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
- data/app/assets/javascripts/spree/backend/stock_transfers/variant_form.coffee +1 -1
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
- data/app/assets/javascripts/spree/backend/taxons.js.coffee +6 -7
- data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/products/sortable.hbs +5 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_percent.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values.hbs +10 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values_select.hbs +1 -0
- data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +19 -0
- data/app/assets/javascripts/spree/backend/templates/stock_transfers/transfer_item.hbs.erb +52 -0
- data/app/assets/javascripts/spree/backend/templates/variants/autocomplete.hbs.erb +23 -0
- data/app/assets/javascripts/spree/backend/templates/variants/autocomplete_stock.hbs +51 -0
- data/app/assets/javascripts/spree/backend/templates/variants/line_items_autocomplete_stock.hbs +67 -0
- data/app/assets/javascripts/spree/backend/templates/variants/split.hbs +27 -0
- data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +6 -8
- data/app/assets/stylesheets/spree/backend/components/_messages.scss +6 -3
- data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +16 -0
- data/app/controllers/spree/admin/base_controller.rb +1 -1
- data/app/controllers/spree/admin/option_types_controller.rb +1 -3
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
- data/app/controllers/spree/admin/orders_controller.rb +6 -11
- data/app/controllers/spree/admin/product_properties_controller.rb +9 -0
- data/app/controllers/spree/admin/products_controller.rb +20 -5
- data/app/controllers/spree/admin/promotions_controller.rb +2 -1
- data/app/controllers/spree/admin/reimbursements_controller.rb +20 -0
- data/app/controllers/spree/admin/resource_controller.rb +1 -1
- data/app/controllers/spree/admin/return_authorizations_controller.rb +5 -0
- data/app/controllers/spree/admin/root_controller.rb +1 -1
- data/app/controllers/spree/admin/search_controller.rb +2 -4
- data/app/controllers/spree/admin/states_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_items_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_transfers_controller.rb +3 -14
- data/app/controllers/spree/admin/users_controller.rb +2 -3
- data/app/controllers/spree/admin/variant_property_rule_values_controller.rb +7 -0
- data/app/controllers/spree/admin/variants_controller.rb +1 -1
- data/app/controllers/spree/admin/zones_controller.rb +1 -1
- data/app/helpers/spree/admin/adjustments_helper.rb +4 -9
- data/app/helpers/spree/admin/base_helper.rb +7 -6
- data/app/helpers/spree/admin/navigation_helper.rb +8 -2
- data/app/helpers/spree/admin/orders_helper.rb +1 -1
- data/app/helpers/spree/admin/products_helper.rb +2 -4
- data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
- data/app/views/spree/admin/adjustments/_adjustment.html.erb +1 -1
- data/app/views/spree/admin/orders/_add_line_item.html.erb +0 -5
- data/app/views/spree/admin/orders/_add_product.html.erb +0 -3
- data/app/views/spree/admin/orders/_carton.html.erb +0 -1
- data/app/views/spree/admin/orders/_shipment.html.erb +0 -1
- data/app/views/spree/admin/orders/confirm/_shipment.html.erb +0 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/edit.html.erb +0 -1
- data/app/views/spree/admin/orders/index.html.erb +1 -2
- data/app/views/spree/admin/payment_methods/_form.html.erb +0 -4
- data/app/views/spree/admin/payment_methods/index.html.erb +0 -2
- data/app/views/spree/admin/payments/source_views/_gateway.html.erb +3 -0
- data/app/views/spree/admin/product_properties/index.html.erb +52 -2
- data/app/views/spree/admin/promotions/_actions.html.erb +14 -10
- data/app/views/spree/admin/promotions/_promotion_action.html.erb +5 -3
- data/app/views/spree/admin/promotions/_promotion_rule.html.erb +5 -3
- data/app/views/spree/admin/promotions/_rules.html.erb +18 -14
- data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +5 -28
- data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +5 -27
- data/app/views/spree/admin/promotions/edit.html.erb +6 -4
- data/app/views/spree/admin/promotions/index.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_option_value.html.erb +13 -0
- data/app/views/spree/admin/refund_reasons/index.html.erb +2 -2
- data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +2 -2
- data/app/views/spree/admin/search/users.rabl +1 -1
- data/app/views/spree/admin/shared/_order_summary.html.erb +6 -0
- data/app/views/spree/admin/shared/_tabs.html.erb +2 -2
- data/app/views/spree/admin/shared/_translations.html.erb +16 -46
- data/app/views/spree/admin/shared/named_types/_index.html.erb +2 -2
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +0 -2
- data/app/views/spree/admin/stock_movements/_form.html.erb +0 -2
- data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -3
- data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
- data/app/views/spree/admin/stock_transfers/show.html.erb +1 -1
- data/app/views/spree/admin/taxons/index.html.erb +0 -1
- data/app/views/spree/admin/users/_addresses_form.html.erb +4 -4
- data/app/views/spree/layouts/admin.html.erb +11 -9
- data/config/routes.rb +5 -0
- data/lib/spree/backend.rb +1 -2
- metadata +41 -139
- data/CHANGELOG.md +0 -1
- data/Gemfile +0 -6
- data/Rakefile +0 -15
- data/app/assets/javascripts/spree/backend/handlebar_extensions.js +0 -9
- data/app/assets/javascripts/spree/backend/promotions.js +0 -73
- data/app/assets/javascripts/spree/backend/stock_transfer.js.coffee +0 -196
- data/app/views/spree/admin/products/_autocomplete.js.erb +0 -14
- data/app/views/spree/admin/products/_sortable.html +0 -7
- data/app/views/spree/admin/stock_items/_stock_location_stock_item_template.html.erb +0 -21
- data/app/views/spree/admin/stock_transfers/_transfer_item_template.html.erb +0 -54
- data/app/views/spree/admin/variants/_autocomplete.js.erb +0 -25
- data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +0 -69
- data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +0 -53
- data/app/views/spree/admin/variants/_split.js.erb +0 -29
- data/script/rails +0 -9
- data/solidus_backend.gemspec +0 -30
- data/spec/controllers/spree/admin/base_controller_spec.rb +0 -24
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -77
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -234
- 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 -80
- data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -472
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -49
- data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -175
- data/spec/controllers/spree/admin/products_controller_spec.rb +0 -45
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -75
- data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -134
- data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -166
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -226
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
- data/spec/controllers/spree/admin/root_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/search_controller_spec.rb +0 -104
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -50
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -331
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -309
- data/spec/controllers/spree/admin/users_controller_spec.rb +0 -236
- data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
- data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -54
- data/spec/features/admin/configuration/countries_spec.rb +0 -22
- data/spec/features/admin/configuration/general_settings_spec.rb +0 -45
- data/spec/features/admin/configuration/payment_methods_spec.rb +0 -125
- data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -64
- data/spec/features/admin/configuration/states_spec.rb +0 -64
- data/spec/features/admin/configuration/stock_locations_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 -30
- data/spec/features/admin/configuration/taxonomies_spec.rb +0 -52
- data/spec/features/admin/configuration/zones_spec.rb +0 -39
- data/spec/features/admin/homepage_spec.rb +0 -78
- data/spec/features/admin/locale_spec.rb +0 -30
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
- data/spec/features/admin/orders/adjustments_spec.rb +0 -126
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -48
- data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -48
- data/spec/features/admin/orders/customer_details_spec.rb +0 -163
- data/spec/features/admin/orders/line_items_spec.rb +0 -50
- data/spec/features/admin/orders/listing_spec.rb +0 -130
- data/spec/features/admin/orders/log_entries_spec.rb +0 -55
- data/spec/features/admin/orders/new_order_spec.rb +0 -197
- data/spec/features/admin/orders/order_details_spec.rb +0 -533
- data/spec/features/admin/orders/payments_spec.rb +0 -228
- data/spec/features/admin/orders/risk_analysis_spec.rb +0 -47
- data/spec/features/admin/orders/shipments_spec.rb +0 -65
- data/spec/features/admin/payments/store_credits_spec.rb +0 -21
- data/spec/features/admin/products/edit/images_spec.rb +0 -87
- data/spec/features/admin/products/edit/products_spec.rb +0 -66
- data/spec/features/admin/products/edit/taxons_spec.rb +0 -56
- data/spec/features/admin/products/edit/variants_spec.rb +0 -61
- data/spec/features/admin/products/option_types_spec.rb +0 -114
- data/spec/features/admin/products/products_spec.rb +0 -392
- data/spec/features/admin/products/properties_spec.rb +0 -139
- data/spec/features/admin/products/prototypes_spec.rb +0 -110
- data/spec/features/admin/products/stock_management_spec.rb +0 -82
- data/spec/features/admin/products/variant_spec.rb +0 -51
- data/spec/features/admin/promotion_adjustments_spec.rb +0 -220
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -69
- data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
- data/spec/features/admin/reports_spec.rb +0 -61
- data/spec/features/admin/stock_transfer_spec.rb +0 -86
- data/spec/features/admin/store_credits_spec.rb +0 -82
- data/spec/features/admin/taxons_spec.rb +0 -31
- data/spec/features/admin/users_spec.rb +0 -270
- data/spec/helpers/admin/base_helper_spec.rb +0 -24
- data/spec/helpers/admin/navigation_helper_spec.rb +0 -73
- data/spec/helpers/admin/reimbursements_helper_spec.rb +0 -34
- data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -95
- data/spec/helpers/promotion_rules_helper_spec.rb +0 -12
- data/spec/spec_helper.rb +0 -108
- data/spec/support/appear_before_matcher.rb +0 -8
- data/spec/support/ror_ringer.jpeg +0 -0
- data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
- data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
- data/vendor/assets/javascripts/handlebars.js +0 -2746
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Tax Categories", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
visit spree.admin_path
|
8
|
-
click_link "Settings"
|
9
|
-
end
|
10
|
-
|
11
|
-
context "admin visiting tax categories list" do
|
12
|
-
it "should display the existing tax categories" do
|
13
|
-
create(:tax_category, :name => "Clothing", :tax_code => "CL001", :description => "For Clothing")
|
14
|
-
click_link "Tax Categories"
|
15
|
-
expect(page).to have_content("Listing Tax Categories")
|
16
|
-
within_row(1) do
|
17
|
-
expect(column_text(1)).to eq("Clothing")
|
18
|
-
expect(column_text(2)).to eq("CL001")
|
19
|
-
expect(column_text(3)).to eq("For Clothing")
|
20
|
-
expect(column_text(4)).to eq("No")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
context "admin creating new tax category" do
|
26
|
-
before(:each) do
|
27
|
-
click_link "Tax Categories"
|
28
|
-
click_link "admin_new_tax_categories_link"
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should be able to create new tax category" do
|
32
|
-
expect(page).to have_content("New Tax Category")
|
33
|
-
fill_in "tax_category_name", :with => "sports goods"
|
34
|
-
fill_in "tax_category_description", :with => "sports goods desc"
|
35
|
-
click_button "Create"
|
36
|
-
expect(page).to have_content("successfully created!")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should show validation errors if there are any" do
|
40
|
-
click_button "Create"
|
41
|
-
expect(page).to have_content("Name can't be blank")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context "admin editing a tax category" do
|
46
|
-
it "should be able to update an existing tax category" do
|
47
|
-
create(:tax_category)
|
48
|
-
click_link "Tax Categories"
|
49
|
-
within_row(1) { click_icon :edit }
|
50
|
-
fill_in "tax_category_description", :with => "desc 99"
|
51
|
-
click_button "Update"
|
52
|
-
expect(page).to have_content("successfully updated!")
|
53
|
-
expect(page).to have_content("desc 99")
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Tax Rates", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:tax_rate) { create(:tax_rate, :calculator => stub_model(Spree::Calculator)) }
|
7
|
-
|
8
|
-
before do
|
9
|
-
visit spree.admin_path
|
10
|
-
click_link "Settings"
|
11
|
-
end
|
12
|
-
|
13
|
-
# Regression test for #535
|
14
|
-
it "can see a tax rate in the list if the tax category has been deleted" do
|
15
|
-
tax_rate.tax_category.update_column(:deleted_at, Time.now)
|
16
|
-
expect { click_link "Tax Rates" }.not_to raise_error
|
17
|
-
within(:xpath, all("table tbody td")[2].path) do
|
18
|
-
expect(page).to have_content("N/A")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
# Regression test for #1422
|
23
|
-
it "can create a new tax rate" do
|
24
|
-
click_link "Tax Rates"
|
25
|
-
click_link "New Tax Rate"
|
26
|
-
fill_in "Rate", :with => "0.05"
|
27
|
-
click_button "Create"
|
28
|
-
expect(page).to have_content("Tax Rate has been successfully created!")
|
29
|
-
end
|
30
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Taxonomies", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
visit spree.admin_path
|
8
|
-
click_link "Settings"
|
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,39 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Zones", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
Spree::Zone.delete_all
|
8
|
-
visit spree.admin_path
|
9
|
-
click_link "Settings"
|
10
|
-
end
|
11
|
-
|
12
|
-
context "show" do
|
13
|
-
it "should display existing zones" do
|
14
|
-
create(:zone, :name => "eastern", :description => "zone is eastern")
|
15
|
-
create(:zone, :name => "western", :description => "cool san fran")
|
16
|
-
click_link "Zones"
|
17
|
-
|
18
|
-
within_row(1) { expect(page).to have_content("eastern") }
|
19
|
-
within_row(2) { expect(page).to have_content("western") }
|
20
|
-
|
21
|
-
click_link "zones_order_by_description_title"
|
22
|
-
|
23
|
-
within_row(1) { expect(page).to have_content("western") }
|
24
|
-
within_row(2) { expect(page).to have_content("eastern") }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context "create" do
|
29
|
-
it "should allow an admin to create a new zone" do
|
30
|
-
click_link "Zones"
|
31
|
-
click_link "admin_new_zone_link"
|
32
|
-
expect(page).to have_content("New Zone")
|
33
|
-
fill_in "zone_name", :with => "japan"
|
34
|
-
fill_in "zone_description", :with => "japanese time zone"
|
35
|
-
click_button "Create"
|
36
|
-
expect(page).to have_content("successfully created!")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Homepage", :type => :feature do
|
4
|
-
|
5
|
-
context 'as admin user' do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
context "visiting the homepage" do
|
9
|
-
before(:each) do
|
10
|
-
visit spree.admin_path
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should have a link to overview" do
|
14
|
-
within(:xpath, ".//figure[@data-hook='logo-wrapper']") { page.find(:xpath, "a[@href='/admin']") }
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should have a link to orders" do
|
18
|
-
page.find_link("Orders")['/admin/orders']
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have a link to products" do
|
22
|
-
page.find_link("Products")['/admin/products']
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should have a link to reports" do
|
26
|
-
page.find_link("Reports")['/admin/reports']
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should have a link to configuration" do
|
30
|
-
page.find_link("Settings")['/admin/configurations']
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context "visiting the products tab" do
|
35
|
-
before(:each) do
|
36
|
-
visit spree.admin_products_path
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should have a link to products" do
|
40
|
-
within('#sub-menu') { page.find_link("Products")['/admin/products'] }
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should have a link to option types" do
|
44
|
-
within('#sub-menu') { page.find_link("Option Types")['/admin/option_types'] }
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should have a link to properties" do
|
48
|
-
within('#sub-menu') { page.find_link("Properties")['/admin/properties'] }
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should have a link to prototypes" do
|
52
|
-
within('#sub-menu') { page.find_link("Prototypes")['/admin/prototypes'] }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'as fakedispatch user' do
|
58
|
-
|
59
|
-
before do
|
60
|
-
allow_any_instance_of(Spree::Admin::BaseController).to receive(:spree_current_user).and_return(nil)
|
61
|
-
end
|
62
|
-
|
63
|
-
custom_authorization! do |user|
|
64
|
-
can [:admin, :home], :dashboards
|
65
|
-
can [:admin, :edit, :index, :read], Spree::Order
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'should only display tabs fakedispatch has access to' do
|
69
|
-
visit spree.admin_path
|
70
|
-
expect(page).to have_link('Orders')
|
71
|
-
expect(page).not_to have_link('Products')
|
72
|
-
expect(page).not_to have_link('Promotions')
|
73
|
-
expect(page).not_to have_link('Reports')
|
74
|
-
expect(page).not_to have_link('Settings')
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "setting locale", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before do
|
7
|
-
I18n.locale = I18n.default_locale
|
8
|
-
I18n.backend.store_translations(:fr,
|
9
|
-
:date => {
|
10
|
-
:month_names => [],
|
11
|
-
},
|
12
|
-
:spree => {
|
13
|
-
:admin => {
|
14
|
-
:tab => { :orders => "Ordres" }
|
15
|
-
},
|
16
|
-
:listing_orders => "Ordres",
|
17
|
-
})
|
18
|
-
Spree::Backend::Config[:locale] = "fr"
|
19
|
-
end
|
20
|
-
|
21
|
-
after do
|
22
|
-
I18n.locale = I18n.default_locale
|
23
|
-
Spree::Backend::Config[:locale] = "en"
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should be in french" do
|
27
|
-
visit spree.admin_path
|
28
|
-
expect(page).to have_content("Ordres")
|
29
|
-
end
|
30
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Adjustments Promotions", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
promotion = create(:promotion_with_item_adjustment,
|
8
|
-
:name => "$10 off",
|
9
|
-
:path => 'test',
|
10
|
-
:code => "10_off",
|
11
|
-
:starts_at => 1.day.ago,
|
12
|
-
:expires_at => 1.day.from_now,
|
13
|
-
:adjustment_rate => 10)
|
14
|
-
|
15
|
-
order = create(:order_with_totals)
|
16
|
-
line_item = order.line_items.first
|
17
|
-
# so we can be sure of a determinate price in our assertions
|
18
|
-
line_item.update_column(:price, 10)
|
19
|
-
|
20
|
-
visit spree.admin_order_adjustments_path(order)
|
21
|
-
end
|
22
|
-
|
23
|
-
context "admin adding a promotion" do
|
24
|
-
context "successfully" do
|
25
|
-
it "should create a new adjustment", :js => true do
|
26
|
-
fill_in "coupon_code", :with => "10_off"
|
27
|
-
click_button "Add Coupon Code"
|
28
|
-
expect(page).to have_content("$10 off")
|
29
|
-
expect(page).to have_content("-$10.00")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "for non-existing promotion" do
|
34
|
-
it "should show an error message", :js => true do
|
35
|
-
fill_in "coupon_code", :with => "does_not_exist"
|
36
|
-
click_button "Add Coupon Code"
|
37
|
-
expect(page).to have_content("doesn't exist.")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
context "for already applied promotion" do
|
42
|
-
it "should show an error message", :js => true do
|
43
|
-
fill_in "coupon_code", :with => "10_off"
|
44
|
-
click_button "Add Coupon Code"
|
45
|
-
expect(page).to have_content('-$10.00')
|
46
|
-
|
47
|
-
fill_in "coupon_code", :with => "10_off"
|
48
|
-
click_button "Add Coupon Code"
|
49
|
-
expect(page).to have_content("already been applied")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Adjustments", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:order) { create(:completed_order_with_totals, line_items_count: 5) }
|
7
|
-
let!(:line_item) do
|
8
|
-
line_item = order.line_items.first
|
9
|
-
# so we can be sure of a determinate price in our assertions
|
10
|
-
line_item.update_column(:price, 10)
|
11
|
-
line_item
|
12
|
-
end
|
13
|
-
|
14
|
-
let!(:tax_adjustment) do
|
15
|
-
create(:tax_adjustment,
|
16
|
-
:adjustable => line_item,
|
17
|
-
:state => 'closed',
|
18
|
-
:order => order,
|
19
|
-
:label => "VAT 5%",
|
20
|
-
:amount => 10)
|
21
|
-
end
|
22
|
-
|
23
|
-
let!(:adjustment) { order.adjustments.create!(order: order, label: 'Rebate', amount: 10) }
|
24
|
-
|
25
|
-
before(:each) do
|
26
|
-
# To ensure the order totals are correct
|
27
|
-
order.update_totals
|
28
|
-
order.persist_totals
|
29
|
-
|
30
|
-
visit spree.admin_path
|
31
|
-
click_link "Orders"
|
32
|
-
within_row(1) { click_icon :edit }
|
33
|
-
click_link "Adjustments"
|
34
|
-
end
|
35
|
-
|
36
|
-
context "admin managing adjustments" do
|
37
|
-
it "should display the correct values for existing order adjustments" do
|
38
|
-
within_row(1) do
|
39
|
-
expect(column_text(2)).to eq("VAT 5%")
|
40
|
-
expect(column_text(3)).to eq("$10.00")
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
it "only shows eligible adjustments" do
|
45
|
-
expect(page).not_to have_content("ineligible")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "admin creating a new adjustment" do
|
50
|
-
before(:each) do
|
51
|
-
click_link "New Adjustment"
|
52
|
-
end
|
53
|
-
|
54
|
-
context "successfully" do
|
55
|
-
it "should create a new adjustment" do
|
56
|
-
fill_in "adjustment_amount", :with => "10"
|
57
|
-
fill_in "adjustment_label", :with => "rebate"
|
58
|
-
click_button "Continue"
|
59
|
-
|
60
|
-
order.reload.all_adjustments.each do |adjustment|
|
61
|
-
expect(adjustment.order_id).to equal(order.id)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
context "with validation errors" do
|
67
|
-
it "should not create a new adjustment" do
|
68
|
-
fill_in "adjustment_amount", :with => ""
|
69
|
-
fill_in "adjustment_label", :with => ""
|
70
|
-
click_button "Continue"
|
71
|
-
expect(page).to have_content("Label can't be blank")
|
72
|
-
expect(page).to have_content("Amount is not a number")
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
context "admin editing an adjustment" do
|
78
|
-
|
79
|
-
before(:each) do
|
80
|
-
within_row(2) { click_icon :edit }
|
81
|
-
end
|
82
|
-
|
83
|
-
context "successfully" do
|
84
|
-
it "should update the adjustment" do
|
85
|
-
fill_in "adjustment_amount", :with => "99"
|
86
|
-
fill_in "adjustment_label", :with => "rebate 99"
|
87
|
-
click_button "Continue"
|
88
|
-
expect(page).to have_content("successfully updated!")
|
89
|
-
expect(page).to have_content("rebate 99")
|
90
|
-
within(".adjustments") do
|
91
|
-
expect(page).to have_content("$99.00")
|
92
|
-
end
|
93
|
-
|
94
|
-
expect(page).to have_content("Total: $259.00")
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
context "with validation errors" do
|
99
|
-
it "should not update the adjustment" do
|
100
|
-
fill_in "adjustment_amount", :with => ""
|
101
|
-
fill_in "adjustment_label", :with => ""
|
102
|
-
click_button "Continue"
|
103
|
-
expect(page).to have_content("Label can't be blank")
|
104
|
-
expect(page).to have_content("Amount is not a number")
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
context "deleting an adjustment" do
|
110
|
-
it "should not be possible if adjustment is closed" do
|
111
|
-
within_row(1) do
|
112
|
-
expect(page).not_to have_css('.fa-trash')
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
it "should update the total", :js => true do
|
117
|
-
accept_alert do
|
118
|
-
within_row(2) do
|
119
|
-
click_icon(:trash)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
expect(page).to have_content(/TOTAL: ?\$170\.00/)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|