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,61 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Reports", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
context "visiting the admin reports page" do
|
7
|
-
it "should have the right content" do
|
8
|
-
visit spree.admin_path
|
9
|
-
click_link "Reports"
|
10
|
-
click_link "Sales Total"
|
11
|
-
|
12
|
-
expect(page).to have_content("Sales Totals")
|
13
|
-
expect(page).to have_content("Item Total")
|
14
|
-
expect(page).to have_content("Adjustment Total")
|
15
|
-
expect(page).to have_content("Sales Total")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context "searching the admin reports page" do
|
20
|
-
before do
|
21
|
-
order = create(:order)
|
22
|
-
order.update_columns({:adjustment_total => 100})
|
23
|
-
order.completed_at = Time.current
|
24
|
-
order.save!
|
25
|
-
|
26
|
-
order = create(:order)
|
27
|
-
order.update_columns({:adjustment_total => 200})
|
28
|
-
order.completed_at = Time.current
|
29
|
-
order.save!
|
30
|
-
|
31
|
-
#incomplete order
|
32
|
-
order = create(:order)
|
33
|
-
order.update_columns({:adjustment_total => 50})
|
34
|
-
order.save!
|
35
|
-
|
36
|
-
order = create(:order)
|
37
|
-
order.update_columns({:adjustment_total => 200})
|
38
|
-
order.completed_at = 3.years.ago
|
39
|
-
order.created_at = 3.years.ago
|
40
|
-
order.save!
|
41
|
-
|
42
|
-
order = create(:order)
|
43
|
-
order.update_columns({:adjustment_total => 200})
|
44
|
-
order.completed_at = 3.years.from_now
|
45
|
-
order.created_at = 3.years.from_now
|
46
|
-
order.save!
|
47
|
-
end
|
48
|
-
|
49
|
-
it "should allow me to search for reports" do
|
50
|
-
visit spree.admin_path
|
51
|
-
click_link "Reports"
|
52
|
-
click_link "Sales Total"
|
53
|
-
|
54
|
-
fill_in "q_completed_at_gt", :with => 1.week.ago
|
55
|
-
fill_in "q_completed_at_lt", :with => 1.week.from_now
|
56
|
-
click_button "Search"
|
57
|
-
|
58
|
-
expect(page).to have_content("$300.00")
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'ReturnAuthorizationReason', type: :feature, js: true do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:order) { create(:shipped_order) }
|
7
|
-
let!(:stock_location) { create(:stock_location) }
|
8
|
-
let!(:rma_reason) { create(:return_authorization_reason, name: 'Defect #1', mutable: true) }
|
9
|
-
let!(:rma_reason2) { create(:return_authorization_reason, name: 'Defect #2', mutable: true) }
|
10
|
-
|
11
|
-
let!(:return_authorization) do
|
12
|
-
create(
|
13
|
-
:return_authorization,
|
14
|
-
order: order,
|
15
|
-
stock_location: stock_location,
|
16
|
-
reason: rma_reason
|
17
|
-
)
|
18
|
-
end
|
19
|
-
|
20
|
-
before { visit spree.admin_return_authorization_reasons_path }
|
21
|
-
|
22
|
-
describe 'destroy' do
|
23
|
-
it 'has return authorization reasons' do
|
24
|
-
within('.table #return_authorization_reasons') do
|
25
|
-
expect(page).to have_content(rma_reason.name)
|
26
|
-
expect(page).to have_content(rma_reason2.name)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'should not destroy an associated option type' do
|
31
|
-
before { within_row(1) { delete_product_property } }
|
32
|
-
|
33
|
-
it 'has persisted return authorization reasons' do
|
34
|
-
within('.table #return_authorization_reasons') do
|
35
|
-
expect(page).to have_content(rma_reason.name)
|
36
|
-
expect(page).to have_content(rma_reason2.name)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
it(js: false) { expect(Spree::ReturnAuthorizationReason.all).to include(rma_reason) }
|
41
|
-
it(js: false) { expect(Spree::ReturnAuthorizationReason.all).to include(rma_reason2) }
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'should allow an admin to destroy a non associated option type' do
|
45
|
-
before { within_row(2) { delete_product_property } }
|
46
|
-
|
47
|
-
it 'has persisted return authorization reasons' do
|
48
|
-
within('.table #return_authorization_reasons') do
|
49
|
-
expect(page).to have_content(rma_reason.name)
|
50
|
-
expect(page).not_to have_content(rma_reason2.name)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
it(js: false) { expect(Spree::ReturnAuthorizationReason.all).to include(rma_reason) }
|
55
|
-
it(js: false) { expect(Spree::ReturnAuthorizationReason.all).not_to include(rma_reason2) }
|
56
|
-
end
|
57
|
-
|
58
|
-
def delete_product_property
|
59
|
-
click_icon :delete
|
60
|
-
wait_for_ajax
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe "Customer Returns", type: :feature do
|
5
|
-
stub_authorization!
|
6
|
-
let!(:customer_return) { create(:customer_return, created_at: Time.current) }
|
7
|
-
|
8
|
-
describe "listing" do
|
9
|
-
let!(:customer_return_2) { create(:customer_return, created_at: Time.current - 1.day) }
|
10
|
-
|
11
|
-
before(:each) do
|
12
|
-
visit spree.admin_customer_returns_path
|
13
|
-
end
|
14
|
-
|
15
|
-
it "lists sorted by created_at" do
|
16
|
-
within_row(1) { expect(page).to have_content(customer_return.number) }
|
17
|
-
within_row(2) { expect(page).to have_content(customer_return_2.number) }
|
18
|
-
end
|
19
|
-
|
20
|
-
it "displays pre tax total" do
|
21
|
-
within_row(1) { expect(page).to have_content(customer_return.display_pre_tax_total.to_html) }
|
22
|
-
end
|
23
|
-
|
24
|
-
it "displays order number" do
|
25
|
-
within_row(1) { expect(page).to have_content(customer_return.order.number) }
|
26
|
-
end
|
27
|
-
|
28
|
-
it "displays customer return number" do
|
29
|
-
within_row(1) { expect(page).to have_content(customer_return.number) }
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'displays status' do
|
33
|
-
within_row(1) { expect(page).to have_content(Spree.t(:incomplete)) }
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'has edit link' do
|
37
|
-
expect(page).to have_css('.icon-edit')
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "searching" do
|
42
|
-
let!(:customer_return_2) { create(:customer_return) }
|
43
|
-
|
44
|
-
it "searches on number" do
|
45
|
-
visit spree.admin_customer_returns_path
|
46
|
-
|
47
|
-
click_on 'Filter'
|
48
|
-
fill_in "q_number_cont", with: customer_return.number
|
49
|
-
click_on 'Search'
|
50
|
-
|
51
|
-
expect(page).to have_content(customer_return.number)
|
52
|
-
expect(page).not_to have_content(customer_return_2.number)
|
53
|
-
|
54
|
-
click_on 'Filter'
|
55
|
-
fill_in "q_number_cont", with: customer_return_2.number
|
56
|
-
click_on 'Search'
|
57
|
-
|
58
|
-
expect(page).to have_content(customer_return_2.number)
|
59
|
-
expect(page).not_to have_content(customer_return.number)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe 'link' do
|
64
|
-
describe 'order number' do
|
65
|
-
it 'opens orders edit page' do
|
66
|
-
visit spree.admin_customer_returns_path
|
67
|
-
click_link customer_return.order.number
|
68
|
-
expect(page).to have_content("Orders / #{customer_return.order.number}")
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe 'customer return number' do
|
73
|
-
it 'opens customer return edit page' do
|
74
|
-
visit spree.admin_customer_returns_path
|
75
|
-
click_link customer_return.number
|
76
|
-
expect(page).to have_content("Customer Return ##{customer_return.number}")
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,152 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe "Return Authorizations", type: :feature do
|
5
|
-
stub_authorization!
|
6
|
-
|
7
|
-
describe "listing" do
|
8
|
-
let!(:return_authorization) { create(:return_authorization, created_at: Time.current) }
|
9
|
-
let!(:return_authorization_2) { create(:return_authorization, created_at: Time.current - 1.day) }
|
10
|
-
|
11
|
-
before(:each) do
|
12
|
-
visit spree.admin_return_authorizations_path
|
13
|
-
end
|
14
|
-
|
15
|
-
it "lists return authorizations sorted by created_at" do
|
16
|
-
within_row(1) { expect(page).to have_content(return_authorization.number) }
|
17
|
-
within_row(2) { expect(page).to have_content(return_authorization_2.number) }
|
18
|
-
end
|
19
|
-
|
20
|
-
it "displays order number" do
|
21
|
-
within_row(1) { expect(page).to have_content(return_authorization.order.number) }
|
22
|
-
end
|
23
|
-
|
24
|
-
it "displays return authorization number" do
|
25
|
-
within_row(1) { expect(page).to have_content(return_authorization.number) }
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'displays state' do
|
29
|
-
return_authorization_state = Spree.t("return_authorization_states.#{return_authorization.state}")
|
30
|
-
within_row(1) { expect(page).to have_content(return_authorization_state) }
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'has edit link' do
|
34
|
-
expect(page).to have_css('.icon-edit')
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "searching" do
|
39
|
-
let!(:return_authorization) { create(:return_authorization, state: 'authorized') }
|
40
|
-
let!(:return_authorization_2) { create(:return_authorization, state: 'canceled') }
|
41
|
-
|
42
|
-
it "searches on number" do
|
43
|
-
visit spree.admin_return_authorizations_path
|
44
|
-
|
45
|
-
click_on 'Filter'
|
46
|
-
fill_in "q_number_cont", with: return_authorization.number
|
47
|
-
click_on 'Search'
|
48
|
-
|
49
|
-
expect(page).to have_content(return_authorization.number)
|
50
|
-
expect(page).not_to have_content(return_authorization_2.number)
|
51
|
-
|
52
|
-
click_on 'Filter'
|
53
|
-
fill_in "q_number_cont", with: return_authorization_2.number
|
54
|
-
click_on 'Search'
|
55
|
-
|
56
|
-
expect(page).to have_content(return_authorization_2.number)
|
57
|
-
expect(page).not_to have_content(return_authorization.number)
|
58
|
-
end
|
59
|
-
|
60
|
-
it "searches on status" do
|
61
|
-
visit spree.admin_return_authorizations_path
|
62
|
-
|
63
|
-
click_on 'Filter'
|
64
|
-
select Spree.t("return_authorization_states.#{return_authorization.state}"), from: 'Status'
|
65
|
-
click_on 'Search'
|
66
|
-
|
67
|
-
expect(page).to have_content(return_authorization.number)
|
68
|
-
expect(page).not_to have_content(return_authorization_2.number)
|
69
|
-
|
70
|
-
click_on 'Filter'
|
71
|
-
select Spree.t("return_authorization_states.#{return_authorization_2.state}"), from: 'Status'
|
72
|
-
click_on 'Search'
|
73
|
-
|
74
|
-
expect(page).to have_content(return_authorization_2.number)
|
75
|
-
expect(page).not_to have_content(return_authorization.number)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
describe 'link' do
|
80
|
-
let!(:return_authorization) { create(:return_authorization) }
|
81
|
-
|
82
|
-
describe 'order number' do
|
83
|
-
it 'opens orders edit page' do
|
84
|
-
visit spree.admin_return_authorizations_path
|
85
|
-
click_link return_authorization.order.number
|
86
|
-
expect(page).to have_content("Orders / #{return_authorization.order.number}")
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe 'return authorization number' do
|
91
|
-
it 'opens return authorization edit page' do
|
92
|
-
visit spree.admin_return_authorizations_path
|
93
|
-
click_link return_authorization.number
|
94
|
-
expect(page).to have_content(return_authorization.number)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe 'authorized' do
|
99
|
-
let!(:return_authorization) { create(:return_authorization, state: 'authorized') }
|
100
|
-
let!(:return_authorization_2) { create(:return_authorization, state: 'canceled') }
|
101
|
-
|
102
|
-
it 'only shows authorized return authorizations' do
|
103
|
-
visit spree.admin_return_authorizations_path
|
104
|
-
within('.nav-tabs') do
|
105
|
-
click_link 'Authorized'
|
106
|
-
end
|
107
|
-
|
108
|
-
expect(page).to have_content(return_authorization.number)
|
109
|
-
expect(page).not_to have_content(return_authorization_2.number)
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'preselects authorized status in filter' do
|
113
|
-
visit spree.admin_return_authorizations_path
|
114
|
-
within('.nav-tabs') do
|
115
|
-
click_link 'Authorized'
|
116
|
-
end
|
117
|
-
|
118
|
-
within('#table-filter') do
|
119
|
-
return_authorization_state = Spree.t("return_authorization_states.#{return_authorization.state}")
|
120
|
-
expect(page).to have_select("Status", selected: return_authorization_state)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
describe 'canceled' do
|
126
|
-
let!(:return_authorization) { create(:return_authorization, state: 'canceled') }
|
127
|
-
let!(:return_authorization_2) { create(:return_authorization, state: 'authorized') }
|
128
|
-
|
129
|
-
it 'only shows canceled return authorizations' do
|
130
|
-
visit spree.admin_return_authorizations_path
|
131
|
-
within('.nav-tabs') do
|
132
|
-
click_link 'Canceled'
|
133
|
-
end
|
134
|
-
|
135
|
-
expect(page).to have_content(return_authorization.number)
|
136
|
-
expect(page).not_to have_content(return_authorization_2.number)
|
137
|
-
end
|
138
|
-
|
139
|
-
it 'preselects canceled status in filter' do
|
140
|
-
visit spree.admin_return_authorizations_path
|
141
|
-
within('.nav-tabs') do
|
142
|
-
click_link 'Canceled'
|
143
|
-
end
|
144
|
-
|
145
|
-
within('#table-filter') do
|
146
|
-
return_authorization_state = Spree.t("return_authorization_states.#{return_authorization.state}")
|
147
|
-
expect(page).to have_select("Status", selected: return_authorization_state)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
152
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Stock Transfers', type: :feature, js: true do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
it 'transfer between 2 locations' do
|
7
|
-
source_location = create(:stock_location_with_items, name: 'NY')
|
8
|
-
destination_location = create(:stock_location, name: 'SF')
|
9
|
-
variant = Spree::Variant.last
|
10
|
-
|
11
|
-
visit spree.admin_stock_transfers_path
|
12
|
-
click_on 'New Stock Transfer'
|
13
|
-
fill_in 'reference', with: 'PO 666'
|
14
|
-
|
15
|
-
select2_search variant.name, from: 'Variant'
|
16
|
-
|
17
|
-
click_button 'Add'
|
18
|
-
click_button 'Transfer Stock'
|
19
|
-
|
20
|
-
expect(page).to have_content('Reference PO 666')
|
21
|
-
expect(page).to have_content('NY')
|
22
|
-
expect(page).to have_content('SF')
|
23
|
-
expect(page).to have_content(variant.name)
|
24
|
-
|
25
|
-
transfer = Spree::StockTransfer.last
|
26
|
-
expect(transfer.stock_movements.size).to eq 2
|
27
|
-
end
|
28
|
-
|
29
|
-
describe 'received stock transfer' do
|
30
|
-
def it_is_received_stock_transfer(page)
|
31
|
-
expect(page).to have_content('Reference PO 666')
|
32
|
-
expect(page).not_to have_selector("#stock-location-source")
|
33
|
-
expect(page).to have_selector("#stock-location-destination")
|
34
|
-
|
35
|
-
transfer = Spree::StockTransfer.last
|
36
|
-
expect(transfer.stock_movements.size).to eq 1
|
37
|
-
expect(transfer.source_location).to be_nil
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'receive stock to a single location' do
|
41
|
-
source_location = create(:stock_location_with_items, name: 'NY')
|
42
|
-
destination_location = create(:stock_location, name: 'SF')
|
43
|
-
variant = Spree::Variant.last
|
44
|
-
|
45
|
-
visit spree.new_admin_stock_transfer_path
|
46
|
-
|
47
|
-
fill_in 'reference', with: 'PO 666'
|
48
|
-
check 'transfer_receive_stock'
|
49
|
-
select('NY', from: 'transfer_destination_location_id')
|
50
|
-
select2_search variant.name, from: 'Variant'
|
51
|
-
|
52
|
-
click_button 'Add'
|
53
|
-
click_button 'Transfer Stock'
|
54
|
-
|
55
|
-
it_is_received_stock_transfer page
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'forced to only receive there is only one location' do
|
59
|
-
source_location = create(:stock_location_with_items, name: 'NY')
|
60
|
-
variant = Spree::Variant.last
|
61
|
-
|
62
|
-
visit spree.new_admin_stock_transfer_path
|
63
|
-
|
64
|
-
fill_in 'reference', with: 'PO 666'
|
65
|
-
|
66
|
-
select('NY', from: 'transfer_destination_location_id')
|
67
|
-
select2_search variant.name, from: 'Variant'
|
68
|
-
|
69
|
-
click_button 'Add'
|
70
|
-
click_button 'Transfer Stock'
|
71
|
-
|
72
|
-
it_is_received_stock_transfer page
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Store credits admin' do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:admin_user) { create(:admin_user) }
|
7
|
-
let!(:store_credit) { create(:store_credit) }
|
8
|
-
|
9
|
-
before do
|
10
|
-
allow(Spree.user_class).to receive(:find_by).and_return(store_credit.user)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'visiting the store credits page' do
|
14
|
-
before do
|
15
|
-
visit spree.admin_path
|
16
|
-
click_link 'Users'
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should be on the store credits page' do
|
20
|
-
click_link store_credit.user.email
|
21
|
-
click_link 'Store Credits'
|
22
|
-
expect(page.current_path).to eq spree.admin_user_store_credits_path(store_credit.user)
|
23
|
-
|
24
|
-
store_credit_table = page.find('table')
|
25
|
-
expect(store_credit_table.all('tr').count).to eq 1
|
26
|
-
expect(store_credit_table).to have_content(Spree::Money.new(store_credit.amount).to_s)
|
27
|
-
expect(store_credit_table).to have_content(Spree::Money.new(store_credit.amount_used).to_s)
|
28
|
-
expect(store_credit_table).to have_content(store_credit.category_name)
|
29
|
-
expect(store_credit_table).to have_content(store_credit.created_by_email)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe 'creating store credit' do
|
34
|
-
before do
|
35
|
-
visit spree.admin_path
|
36
|
-
click_link 'Users'
|
37
|
-
click_link store_credit.user.email
|
38
|
-
click_link 'Store Credits'
|
39
|
-
allow_any_instance_of(Spree::Admin::StoreCreditsController).to receive(:try_spree_current_user).and_return(admin_user)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should create store credit and associate it with the user' do
|
43
|
-
click_link 'Add Store Credit'
|
44
|
-
page.fill_in 'store_credit_amount', with: '102.00'
|
45
|
-
select 'Exchange', from: 'store_credit_category_id'
|
46
|
-
click_button 'Create'
|
47
|
-
|
48
|
-
expect(page.current_path).to eq spree.admin_user_store_credits_path(store_credit.user)
|
49
|
-
store_credit_table = page.find('table')
|
50
|
-
expect(store_credit_table.all('tr').count).to eq 2
|
51
|
-
expect(Spree::StoreCredit.count).to eq 2
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe 'updating store credit' do
|
56
|
-
let(:updated_amount) { '99.0' }
|
57
|
-
|
58
|
-
before do
|
59
|
-
visit spree.admin_path
|
60
|
-
click_link 'Users'
|
61
|
-
click_link store_credit.user.email
|
62
|
-
click_link 'Store Credits'
|
63
|
-
allow_any_instance_of(Spree::Admin::StoreCreditsController).to receive(:try_spree_current_user).and_return(admin_user)
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'should create store credit and associate it with the user' do
|
67
|
-
click_link 'Edit'
|
68
|
-
page.fill_in 'store_credit_amount', with: updated_amount
|
69
|
-
click_button 'Update'
|
70
|
-
|
71
|
-
expect(page.current_path).to eq spree.admin_user_store_credits_path(store_credit.user)
|
72
|
-
store_credit_table = page.find('table')
|
73
|
-
expect(store_credit_table).to have_content(Spree::Money.new(updated_amount).to_s)
|
74
|
-
expect(store_credit.reload.amount.to_f).to eq updated_amount.to_f
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe 'non-existent user' do
|
79
|
-
before do
|
80
|
-
visit spree.admin_path
|
81
|
-
click_link 'Users'
|
82
|
-
click_link store_credit.user.email
|
83
|
-
store_credit.user.destroy
|
84
|
-
allow(Spree.user_class).to receive(:find_by).and_return(nil)
|
85
|
-
click_link 'Store Credits'
|
86
|
-
allow_any_instance_of(Spree::Admin::StoreCreditsController).to receive(:try_spree_current_user).and_return(admin_user)
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'should display flash withe error' do
|
90
|
-
expect(page).to have_content(Spree.t(:user_not_found))
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|