spree_backend 3.2.1 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/spree/admin/products/_form.html.erb +8 -8
- data/spree_backend.gemspec +2 -2
- metadata +9 -100
- 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 -296
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -64
- 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/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 -130
- 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 -224
- data/spec/features/admin/orders/log_entries_spec.rb +0 -55
- data/spec/features/admin/orders/new_order_spec.rb +0 -186
- data/spec/features/admin/orders/order_details_spec.rb +0 -662
- data/spec/features/admin/orders/payments_spec.rb +0 -231
- 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 -258
- 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/reimbursement_type/edit_reimbursement_type_spec.rb +0 -36
- data/spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb +0 -62
- 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 -111
- data/spec/helpers/admin/promotion_rules_helper_spec.rb +0 -12
- data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -30
- data/spec/models/spree/resource_spec.rb +0 -48
- data/spec/routing/admin_path_spec.rb +0 -22
- data/spec/spec_helper.rb +0 -144
- 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,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Spree
|
4
|
-
describe "Countries", type: :feature do
|
5
|
-
stub_authorization!
|
6
|
-
|
7
|
-
it "deletes a state", js: true do
|
8
|
-
visit spree.admin_countries_path
|
9
|
-
click_link "New Country"
|
10
|
-
|
11
|
-
fill_in "Name", with: "Brazil"
|
12
|
-
fill_in "Iso Name", with: "BRL"
|
13
|
-
click_button "Create"
|
14
|
-
|
15
|
-
accept_alert do
|
16
|
-
click_icon :delete
|
17
|
-
end
|
18
|
-
|
19
|
-
wait_for_ajax
|
20
|
-
|
21
|
-
expect { Country.find(country.id) }.to raise_error(StandardError)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "General Settings", type: :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
store = create(:store, name: 'Test Store', url: 'test.example.org',
|
8
|
-
mail_from_address: 'test@example.org')
|
9
|
-
visit spree.edit_admin_general_settings_path
|
10
|
-
end
|
11
|
-
|
12
|
-
context "visiting general settings (admin)" do
|
13
|
-
it "should have the right content" do
|
14
|
-
expect(page).to have_content("General Settings")
|
15
|
-
expect(find("#store_name").value).to eq("Test Store")
|
16
|
-
expect(find("#store_url").value).to eq("test.example.org")
|
17
|
-
expect(find("#store_mail_from_address").value).to eq("test@example.org")
|
18
|
-
expect(page).to_not have_content(Spree.t(:security_settings))
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "editing general settings (admin)" do
|
23
|
-
it "should be able to update the site name" do
|
24
|
-
fill_in "store_name", with: "Spree Demo Site99"
|
25
|
-
fill_in "store_mail_from_address", with: "spree@example.org"
|
26
|
-
click_button "Update"
|
27
|
-
|
28
|
-
assert_successful_update_message(:general_settings)
|
29
|
-
expect(find("#store_name").value).to eq("Spree Demo Site99")
|
30
|
-
expect(find("#store_mail_from_address").value).to eq("spree@example.org")
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context "clearing the cache", js: true do
|
35
|
-
it "should clear the cache" do
|
36
|
-
expect(page).to_not have_content(Spree.t(:clear_cache_ok))
|
37
|
-
expect(page).to have_content(Spree.t(:clear_cache_warning))
|
38
|
-
|
39
|
-
click_button "Clear Cache"
|
40
|
-
|
41
|
-
expect(page).to have_content(Spree.t(:clear_cache_ok))
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Payment Methods", type: :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
visit spree.admin_payment_methods_path
|
8
|
-
end
|
9
|
-
|
10
|
-
context "admin visiting payment methods listing page" do
|
11
|
-
it "should display existing payment methods" do
|
12
|
-
create(:check_payment_method)
|
13
|
-
visit current_path
|
14
|
-
|
15
|
-
within("table#listing_payment_methods") do
|
16
|
-
expect(all("th")[1].text).to eq("Name")
|
17
|
-
expect(all("th")[2].text).to eq("Provider")
|
18
|
-
expect(all("th")[3].text).to eq("Display")
|
19
|
-
expect(all("th")[4].text).to eq("Active")
|
20
|
-
end
|
21
|
-
|
22
|
-
within('table#listing_payment_methods') do
|
23
|
-
expect(page).to have_content("Spree::PaymentMethod::Check")
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context "admin creating a new payment method" do
|
29
|
-
it "should be able to create a new payment method" do
|
30
|
-
click_link "admin_new_payment_methods_link"
|
31
|
-
expect(page).to have_content("New Payment Method")
|
32
|
-
fill_in "payment_method_name", with: "check90"
|
33
|
-
fill_in "payment_method_description", with: "check90 desc"
|
34
|
-
select "PaymentMethod::Check", from: "gtwy-type"
|
35
|
-
click_button "Create"
|
36
|
-
expect(page).to have_content("successfully created!")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
context "admin editing a payment method", js: true do
|
41
|
-
before(:each) do
|
42
|
-
create(:check_payment_method)
|
43
|
-
visit current_path
|
44
|
-
|
45
|
-
within("table#listing_payment_methods") do
|
46
|
-
click_icon(:edit)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should be able to edit an existing payment method" do
|
51
|
-
fill_in "payment_method_name", with: "Payment 99"
|
52
|
-
click_button "Update"
|
53
|
-
expect(page).to have_content("successfully updated!")
|
54
|
-
expect(find_field("payment_method_name").value).to eq("Payment 99")
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should display validation errors" do
|
58
|
-
fill_in "payment_method_name", with: ""
|
59
|
-
click_button "Update"
|
60
|
-
expect(page).to have_content("Name can't be blank")
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Roles", type: :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
create(:role, name: "admin")
|
8
|
-
create(:role, name: "user")
|
9
|
-
visit spree.admin_path
|
10
|
-
click_link "Configuration"
|
11
|
-
# Crap workaround for animation to finish expanding so click doesn't hit ReimbursementTypes.
|
12
|
-
sleep 1
|
13
|
-
click_link "Roles"
|
14
|
-
end
|
15
|
-
|
16
|
-
context "show" do
|
17
|
-
it "should display existing roles" do
|
18
|
-
within_row(1) { expect(page).to have_content("admin") }
|
19
|
-
within_row(2) { expect(page).to have_content("user") }
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "create" do
|
24
|
-
it "should be able to create a new role" do
|
25
|
-
click_link "admin_new_role_link"
|
26
|
-
expect(page).to have_content("New Role")
|
27
|
-
fill_in "role_name", with: "blogger"
|
28
|
-
click_button "Create"
|
29
|
-
expect(page).to have_content("successfully created!")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "edit" do
|
34
|
-
it "should not be able to edit the admin role" do
|
35
|
-
within_row(1) do
|
36
|
-
expect(find("td:nth-child(2)")).not_to have_selector(:css, "span.icon-edit")
|
37
|
-
expect(find("td:nth-child(2)")).not_to have_selector(:css, "span.icon-delete")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
it "should be able to edit the user role" do
|
41
|
-
within_row(2) do
|
42
|
-
expect(find("td:nth-child(2)")).to have_selector(:css, "span.icon-edit")
|
43
|
-
expect(find("td:nth-child(2)")).to have_selector(:css, "span.icon-delete")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Shipping Methods", type: :feature do
|
4
|
-
stub_authorization!
|
5
|
-
let!(:zone) { create(:global_zone) }
|
6
|
-
let!(:shipping_method) { create(:shipping_method, zones: [zone]) }
|
7
|
-
|
8
|
-
after do
|
9
|
-
Capybara.ignore_hidden_elements = true
|
10
|
-
end
|
11
|
-
|
12
|
-
before do
|
13
|
-
Capybara.ignore_hidden_elements = false
|
14
|
-
# HACK: To work around no email prompting on check out
|
15
|
-
allow_any_instance_of(Spree::Order).to receive_messages(require_email: false)
|
16
|
-
create(:check_payment_method)
|
17
|
-
|
18
|
-
visit spree.admin_shipping_methods_path
|
19
|
-
end
|
20
|
-
|
21
|
-
context "show" do
|
22
|
-
it "should display existing shipping methods" do
|
23
|
-
within_row(1) do
|
24
|
-
expect(column_text(1)).to eq(shipping_method.name)
|
25
|
-
expect(column_text(2)).to eq(zone.name)
|
26
|
-
expect(column_text(3)).to eq("Flat rate")
|
27
|
-
expect(column_text(4)).to eq("Both")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context "create" do
|
33
|
-
it "should be able to create a new shipping method" do
|
34
|
-
click_link "New Shipping Method"
|
35
|
-
|
36
|
-
fill_in "shipping_method_name", with: "bullock cart"
|
37
|
-
|
38
|
-
within("#shipping_method_categories_field") do
|
39
|
-
check first("input[type='checkbox']")["name"]
|
40
|
-
end
|
41
|
-
|
42
|
-
click_on "Create"
|
43
|
-
expect(current_path).to eql(spree.edit_admin_shipping_method_path(Spree::ShippingMethod.last))
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
# Regression test for #1331
|
48
|
-
context "update" do
|
49
|
-
it "can change the calculator", js: true do
|
50
|
-
within("#listing_shipping_methods") do
|
51
|
-
click_icon :edit
|
52
|
-
end
|
53
|
-
|
54
|
-
expect(find(:css, ".calculator-settings-warning")).not_to be_visible
|
55
|
-
select2_search('Flexible Rate', from: 'Calculator')
|
56
|
-
expect(find(:css, ".calculator-settings-warning")).to be_visible
|
57
|
-
|
58
|
-
click_button "Update"
|
59
|
-
expect(page).not_to have_content("Shipping method is not found")
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "States", type: :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:country) { create(:country) }
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
@hungary = Spree::Country.create!(name: "Hungary", iso_name: "Hungary")
|
10
|
-
end
|
11
|
-
|
12
|
-
def go_to_states_page
|
13
|
-
visit spree.admin_country_states_path(country)
|
14
|
-
expect(page).to have_selector('#new_state_link')
|
15
|
-
page.execute_script('$.fx.off = true')
|
16
|
-
end
|
17
|
-
|
18
|
-
context "admin visiting states listing" do
|
19
|
-
let!(:state) { create(:state, country: country) }
|
20
|
-
|
21
|
-
it "should correctly display the states" do
|
22
|
-
visit spree.admin_country_states_path(country)
|
23
|
-
expect(page).to have_content(state.name)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "creating and editing states" do
|
28
|
-
it "should allow an admin to edit existing states", js: true do
|
29
|
-
go_to_states_page
|
30
|
-
set_select2_field("country", country.id)
|
31
|
-
|
32
|
-
click_link "new_state_link"
|
33
|
-
fill_in "state_name", with: "Calgary"
|
34
|
-
fill_in "Abbreviation", with: "CL"
|
35
|
-
click_button "Create"
|
36
|
-
expect(page).to have_content("successfully created!")
|
37
|
-
expect(page).to have_content("Calgary")
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should allow an admin to create states for non default countries", js: true do
|
41
|
-
go_to_states_page
|
42
|
-
set_select2_field "#country", @hungary.id
|
43
|
-
# Just so the change event actually gets triggered in this spec
|
44
|
-
# It is definitely triggered in the "real world"
|
45
|
-
page.execute_script("$('#country').change();")
|
46
|
-
|
47
|
-
click_link "new_state_link"
|
48
|
-
fill_in "state_name", with: "Pest megye"
|
49
|
-
fill_in "Abbreviation", with: "PE"
|
50
|
-
click_button "Create"
|
51
|
-
expect(page).to have_content("successfully created!")
|
52
|
-
expect(page).to have_content("Pest megye")
|
53
|
-
expect(find("#s2id_country span").text).to eq("Hungary")
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should show validation errors", js: true do
|
57
|
-
go_to_states_page
|
58
|
-
set_select2_field("country", country.id)
|
59
|
-
|
60
|
-
click_link "new_state_link"
|
61
|
-
|
62
|
-
fill_in "state_name", with: ""
|
63
|
-
fill_in "Abbreviation", with: ""
|
64
|
-
click_button "Create"
|
65
|
-
expect(page).to have_content("Name can't be blank")
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Stock Locations", type: :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
country = create(:country)
|
8
|
-
visit spree.admin_stock_locations_path
|
9
|
-
end
|
10
|
-
|
11
|
-
it "can create a new stock location" do
|
12
|
-
click_link "New Stock Location"
|
13
|
-
fill_in "Name", with: "London"
|
14
|
-
check "Active"
|
15
|
-
click_button "Create"
|
16
|
-
|
17
|
-
expect(page).to have_content("successfully created")
|
18
|
-
expect(page).to have_content("London")
|
19
|
-
end
|
20
|
-
|
21
|
-
it "can delete an existing stock location", js: true do
|
22
|
-
location = create(:stock_location)
|
23
|
-
visit current_path
|
24
|
-
|
25
|
-
expect(find('#listing_stock_locations')).to have_content("NY Warehouse")
|
26
|
-
accept_alert do
|
27
|
-
click_icon :delete
|
28
|
-
end
|
29
|
-
# Wait for API request to complete.
|
30
|
-
wait_for_ajax
|
31
|
-
visit current_path
|
32
|
-
expect(page).to have_content("No Stock Locations found")
|
33
|
-
end
|
34
|
-
|
35
|
-
it "can update an existing stock location", js: true do
|
36
|
-
create(:stock_location)
|
37
|
-
visit current_path
|
38
|
-
|
39
|
-
expect(page).to have_content("NY Warehouse")
|
40
|
-
|
41
|
-
click_icon :edit
|
42
|
-
fill_in "Name", with: "London"
|
43
|
-
click_button "Update"
|
44
|
-
|
45
|
-
expect(page).to have_content("successfully updated")
|
46
|
-
expect(page).to have_content("London")
|
47
|
-
end
|
48
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Store Credit Categories", type: :feature, js: true do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
visit spree.admin_path
|
8
|
-
click_link "Configuration"
|
9
|
-
end
|
10
|
-
|
11
|
-
context "admin visiting store credit categories list" do
|
12
|
-
it "should display existing store credit categories" do
|
13
|
-
create(:store_credit_category)
|
14
|
-
click_link "Store Credit Categories"
|
15
|
-
|
16
|
-
within_row(1) { expect(page).to have_content("Exchange") }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context "admin creating a new store credit category" do
|
21
|
-
before(:each) do
|
22
|
-
click_link "Store Credit Categories"
|
23
|
-
click_link "admin_new_store_credit_category_link"
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should be able to create a new store credit category" do
|
27
|
-
expect(page).to have_content("New Store Credit Category")
|
28
|
-
fill_in "store_credit_category_name", with: "Return"
|
29
|
-
click_button "Create"
|
30
|
-
expect(page).to have_content("successfully created!")
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should show validation errors if there are any" do
|
34
|
-
click_button "Create"
|
35
|
-
expect(page).to have_content("Name can't be blank")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context "admin editing a store credit category" do
|
40
|
-
it "should be able to update an existing store credit category" do
|
41
|
-
create(:store_credit_category)
|
42
|
-
click_link "Store Credit Categories"
|
43
|
-
within_row(1) { click_icon :edit }
|
44
|
-
fill_in "store_credit_category_name", with: "Return"
|
45
|
-
click_button "Update"
|
46
|
-
expect(page).to have_content("successfully updated!")
|
47
|
-
expect(page).to have_content("Return")
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -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 "Configuration"
|
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
|
-
within("h1") { expect(page).to have_content("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", js: true 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,18 +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
|
-
# Regression test for #1422
|
9
|
-
it "can create a new tax rate" do
|
10
|
-
visit spree.admin_path
|
11
|
-
click_link "Configuration"
|
12
|
-
click_link "Tax Rates"
|
13
|
-
click_link "New Tax Rate"
|
14
|
-
fill_in "Rate", with: "0.05"
|
15
|
-
click_button "Create"
|
16
|
-
expect(page).to have_content("Tax Rate has been successfully created!")
|
17
|
-
end
|
18
|
-
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 "Configuration"
|
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,89 +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 "has header text 'Orders'" do
|
14
|
-
within('h1') { expect(page).to have_content("Orders") }
|
15
|
-
end
|
16
|
-
|
17
|
-
it "has a link to overview" do
|
18
|
-
within("header") { page.find(:xpath, "//a[@href='/admin']") }
|
19
|
-
end
|
20
|
-
|
21
|
-
it "has a link to orders" do
|
22
|
-
page.find_link("Orders")['/admin/orders']
|
23
|
-
end
|
24
|
-
|
25
|
-
it "has a link to products" do
|
26
|
-
page.find_link("Products")['/admin/products']
|
27
|
-
end
|
28
|
-
|
29
|
-
it "has a link to reports" do
|
30
|
-
page.find_link("Reports")['/admin/reports']
|
31
|
-
end
|
32
|
-
|
33
|
-
it "has a link to configuration" do
|
34
|
-
page.find_link("Configuration")['/admin/configurations']
|
35
|
-
end
|
36
|
-
|
37
|
-
it "has a link to return authorizations" do
|
38
|
-
within('.sidebar') { page.find_link("Return Authorizations")['/admin/return_authorizations'] }
|
39
|
-
end
|
40
|
-
|
41
|
-
it "has a link to customer returns" do
|
42
|
-
within('.sidebar') { page.find_link("Customer Returns")['/admin/customer_returns'] }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context "visiting the products tab" do
|
47
|
-
before(:each) do
|
48
|
-
visit spree.admin_products_path
|
49
|
-
end
|
50
|
-
|
51
|
-
it "has a link to products" do
|
52
|
-
within('.sidebar') { page.find_link("Products")['/admin/products'] }
|
53
|
-
end
|
54
|
-
|
55
|
-
it "has a link to option types" do
|
56
|
-
within('.sidebar') { page.find_link("Option Types")['/admin/option_types'] }
|
57
|
-
end
|
58
|
-
|
59
|
-
it "has a link to properties" do
|
60
|
-
within('.sidebar') { page.find_link("Properties")['/admin/properties'] }
|
61
|
-
end
|
62
|
-
|
63
|
-
it "has a link to prototypes" do
|
64
|
-
within('.sidebar') { page.find_link("Prototypes")['/admin/prototypes'] }
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'as fakedispatch user' do
|
70
|
-
|
71
|
-
before do
|
72
|
-
allow_any_instance_of(Spree::Admin::BaseController).to receive(:spree_current_user).and_return(nil)
|
73
|
-
end
|
74
|
-
|
75
|
-
custom_authorization! do |user|
|
76
|
-
can [:admin, :edit, :index, :read], Spree::Order
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'only displays tabs fakedispatch has access to' do
|
80
|
-
visit spree.admin_path
|
81
|
-
expect(page).to have_link('Orders')
|
82
|
-
expect(page).not_to have_link('Products')
|
83
|
-
expect(page).not_to have_link('Promotions')
|
84
|
-
expect(page).not_to have_link('Reports')
|
85
|
-
expect(page).not_to have_link('Configurations')
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
@@ -1,31 +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
|
-
click_link "Ordres"
|
29
|
-
expect(page).to have_content("Ordres")
|
30
|
-
end
|
31
|
-
end
|