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.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/spree/admin/products/_form.html.erb +8 -8
  3. data/spree_backend.gemspec +2 -2
  4. metadata +9 -100
  5. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -46
  6. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -185
  7. data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
  8. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
  9. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -197
  10. data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -296
  11. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -64
  12. data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -97
  13. data/spec/controllers/spree/admin/products_controller_spec.rb +0 -99
  14. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
  15. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
  16. data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -44
  17. data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
  18. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -74
  19. data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -42
  20. data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -252
  21. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -225
  22. data/spec/controllers/spree/admin/return_index_controller_spec.rb +0 -37
  23. data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
  24. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
  25. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -19
  26. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
  27. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -41
  28. data/spec/controllers/spree/admin/tax_categories_controller_spec.rb +0 -34
  29. data/spec/controllers/spree/admin/users_controller_spec.rb +0 -161
  30. data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
  31. data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -47
  32. data/spec/features/admin/configuration/countries_spec.rb +0 -24
  33. data/spec/features/admin/configuration/general_settings_spec.rb +0 -44
  34. data/spec/features/admin/configuration/payment_methods_spec.rb +0 -63
  35. data/spec/features/admin/configuration/roles_spec.rb +0 -47
  36. data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -62
  37. data/spec/features/admin/configuration/states_spec.rb +0 -68
  38. data/spec/features/admin/configuration/stock_locations_spec.rb +0 -48
  39. data/spec/features/admin/configuration/store_credit_categories_spec.rb +0 -50
  40. data/spec/features/admin/configuration/tax_categories_spec.rb +0 -56
  41. data/spec/features/admin/configuration/tax_rates_spec.rb +0 -18
  42. data/spec/features/admin/configuration/zones_spec.rb +0 -39
  43. data/spec/features/admin/homepage_spec.rb +0 -89
  44. data/spec/features/admin/locale_spec.rb +0 -31
  45. data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
  46. data/spec/features/admin/orders/adjustments_spec.rb +0 -130
  47. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -47
  48. data/spec/features/admin/orders/customer_details_spec.rb +0 -154
  49. data/spec/features/admin/orders/line_items_spec.rb +0 -51
  50. data/spec/features/admin/orders/listing_spec.rb +0 -224
  51. data/spec/features/admin/orders/log_entries_spec.rb +0 -55
  52. data/spec/features/admin/orders/new_order_spec.rb +0 -186
  53. data/spec/features/admin/orders/order_details_spec.rb +0 -662
  54. data/spec/features/admin/orders/payments_spec.rb +0 -231
  55. data/spec/features/admin/orders/risk_analysis_spec.rb +0 -48
  56. data/spec/features/admin/orders/shipments_spec.rb +0 -64
  57. data/spec/features/admin/orders/state_changes_spec.rb +0 -21
  58. data/spec/features/admin/products/edit/images_spec.rb +0 -86
  59. data/spec/features/admin/products/edit/products_spec.rb +0 -64
  60. data/spec/features/admin/products/edit/taxons_spec.rb +0 -41
  61. data/spec/features/admin/products/edit/variants_spec.rb +0 -56
  62. data/spec/features/admin/products/option_types_spec.rb +0 -114
  63. data/spec/features/admin/products/products_spec.rb +0 -445
  64. data/spec/features/admin/products/properties_spec.rb +0 -147
  65. data/spec/features/admin/products/prototypes_spec.rb +0 -112
  66. data/spec/features/admin/products/stock_management_spec.rb +0 -124
  67. data/spec/features/admin/products/taxonomies_spec.rb +0 -52
  68. data/spec/features/admin/products/variant_spec.rb +0 -50
  69. data/spec/features/admin/promotions/adjustments_spec.rb +0 -258
  70. data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -70
  71. data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -70
  72. data/spec/features/admin/refund_reasons/refund_reasons_spec.rb +0 -57
  73. data/spec/features/admin/reimbursement_type/edit_reimbursement_type_spec.rb +0 -36
  74. data/spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb +0 -62
  75. data/spec/features/admin/reports_spec.rb +0 -61
  76. data/spec/features/admin/return_authorization_reasons/return_authorization_reasons_spec.rb +0 -63
  77. data/spec/features/admin/returns/customer_returns_spec.rb +0 -80
  78. data/spec/features/admin/returns/return_authorizations_spec.rb +0 -152
  79. data/spec/features/admin/stock_transfer_spec.rb +0 -75
  80. data/spec/features/admin/store_credits_spec.rb +0 -93
  81. data/spec/features/admin/taxons_spec.rb +0 -47
  82. data/spec/features/admin/users_spec.rb +0 -286
  83. data/spec/helpers/admin/base_helper_spec.rb +0 -30
  84. data/spec/helpers/admin/navigation_helper_spec.rb +0 -111
  85. data/spec/helpers/admin/promotion_rules_helper_spec.rb +0 -12
  86. data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -30
  87. data/spec/models/spree/resource_spec.rb +0 -48
  88. data/spec/routing/admin_path_spec.rb +0 -22
  89. data/spec/spec_helper.rb +0 -144
  90. data/spec/support/appear_before_matcher.rb +0 -8
  91. data/spec/support/ror_ringer.jpeg +0 -0
  92. data/spec/test_views/spree/admin/submodule/posts/edit.html.erb +0 -1
  93. data/spec/test_views/spree/admin/submodule/posts/new.html.erb +0 -1
  94. data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
  95. data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
@@ -1,70 +0,0 @@
1
- require 'spec_helper'
2
-
3
- feature "Tiered Calculator Promotions" do
4
- stub_authorization!
5
-
6
- let(:promotion) { create :promotion }
7
-
8
- background do
9
- visit spree.edit_admin_promotion_path(promotion)
10
- end
11
-
12
- scenario "adding a tiered percent calculator", js: true do
13
- select2 "Create whole-order adjustment", from: "Add action of type"
14
- within('#action_fields') { click_button "Add" }
15
-
16
- select2 "Tiered Percent", from: "Calculator"
17
- within('#actions_container') { click_button "Update" }
18
-
19
- within("#actions_container .settings") do
20
- expect(page.body).to have_content("Base Percent")
21
- expect(page.body).to have_content("Tiers")
22
-
23
- click_button "Add"
24
- end
25
-
26
- fill_in "Base Percent", with: 5
27
-
28
- within(".tier") do
29
- find(".js-base-input").set(100)
30
- page.execute_script("$('.js-base-input').change();")
31
- find(".js-value-input").set(10)
32
- page.execute_script("$('.js-value-input').change();")
33
- end
34
- within('#actions_container') { click_button "Update" }
35
-
36
- first_action = promotion.actions.first
37
- expect(first_action.class).to eq Spree::Promotion::Actions::CreateAdjustment
38
-
39
- first_action_calculator = first_action.calculator
40
- expect(first_action_calculator.class).to eq Spree::Calculator::TieredPercent
41
- expect(first_action_calculator.preferred_base_percent).to eq 5
42
- expect(first_action_calculator.preferred_tiers).to eq Hash[100.0 => 10.0]
43
- end
44
-
45
- context "with an existing tiered flat rate calculator" do
46
- let(:promotion) { create :promotion, :with_order_adjustment }
47
-
48
- background do
49
- action = promotion.actions.first
50
-
51
- action.calculator = Spree::Calculator::TieredFlatRate.new
52
- action.calculator.preferred_base_amount = 5
53
- action.calculator.preferred_tiers = Hash[100 => 10, 200 => 15, 300 => 20]
54
- action.calculator.save!
55
-
56
- visit spree.edit_admin_promotion_path(promotion)
57
- end
58
-
59
- scenario "deleting a tier", js: true do
60
- within(".tier:nth-child(2)") do
61
- click_icon :delete
62
- end
63
-
64
- within('#actions_container') { click_button "Update" }
65
-
66
- calculator = promotion.actions.first.calculator
67
- expect(calculator.preferred_tiers).to eq Hash[100.0 => 10.0, 300.0 => 20.0]
68
- end
69
- end
70
- end
@@ -1,57 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'RefundReason', type: :feature, js: true do
4
- stub_authorization!
5
-
6
- let!(:amount) { 100.0 }
7
- let!(:payment_amount) { amount * 2 }
8
- let!(:payment_method) { create(:credit_card_payment_method) }
9
- let!(:payment) { create(:payment, amount: payment_amount, payment_method: payment_method) }
10
- let!(:refund_reason) { create(:default_refund_reason, name: 'Reason #1', mutable: true) }
11
- let!(:refund_reason2) { create(:refund_reason, name: 'Reason #2', mutable: true) }
12
- let!(:refund) { create(:refund, payment: payment, amount: amount, reason: refund_reason, transaction_id: nil) }
13
-
14
- before { visit spree.admin_refund_reasons_path }
15
-
16
- describe 'destroy' do
17
- it 'has refund reasons' do
18
- within('.table #refund_reasons') do
19
- expect(page).to have_content(refund_reason.name)
20
- expect(page).to have_content(refund_reason2.name)
21
- end
22
- end
23
-
24
- context 'should not destroy an associated option type' do
25
- before { within_row(1) { delete_product_property } }
26
-
27
- it 'has persisted refund reasons' do
28
- within('.table #refund_reasons') do
29
- expect(page).to have_content(refund_reason.name)
30
- expect(page).to have_content(refund_reason2.name)
31
- end
32
- end
33
-
34
- it(js: false) { expect(Spree::RefundReason.all).to include(refund_reason) }
35
- it(js: false) { expect(Spree::RefundReason.all).to include(refund_reason2) }
36
- end
37
-
38
- context 'should allow an admin to destroy a non associated option type' do
39
- before { within_row(2) { delete_product_property } }
40
-
41
- it 'has persisted refund reasons' do
42
- within('.table #refund_reasons') do
43
- expect(page).to have_content(refund_reason.name)
44
- expect(page).not_to have_content(refund_reason2.name)
45
- end
46
- end
47
-
48
- it(js: false) { expect(Spree::RefundReason.all).to include(refund_reason) }
49
- it(js: false) { expect(Spree::RefundReason.all).not_to include(refund_reason2) }
50
- end
51
-
52
- def delete_product_property
53
- click_icon :delete
54
- wait_for_ajax
55
- end
56
- end
57
- end
@@ -1,36 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "edit reimbursement type", type: :feature do
4
- stub_authorization!
5
- let(:r_type) do
6
- create(:reimbursement_type,
7
- name: 'Exchange',
8
- type: 'Spree::ReimbursementType::Exchange',
9
- active: true,
10
- mutable: true)
11
- end
12
-
13
- before do
14
- visit "/admin/reimbursement_types/#{r_type.id}/edit"
15
- end
16
-
17
- context "with valid attributes" do
18
- it "change name, active and mutable" do
19
- fill_in "Name", with: "New Credit"
20
- uncheck "Mutable"
21
- uncheck "Active"
22
-
23
- expect { click_button "Create" }.not_to change(Spree::ReimbursementType, :count)
24
-
25
- r_type.reload
26
-
27
- expect(r_type.active).to eq false
28
- expect(r_type.mutable).to eq false
29
- expect(page).to have_content("New Credit")
30
- end
31
- end
32
-
33
- it "view should have select field" do
34
- expect(page).not_to have_css("div#reimbursement_type_type_field.form-group.field")
35
- end
36
- end
@@ -1,62 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "new reimbursement type", type: :feature do
4
- stub_authorization!
5
-
6
- before do
7
- visit "/admin/reimbursement_types/new"
8
- end
9
-
10
- it "view should have select field" do
11
- expect(page).to have_css("div#reimbursement_type_type_field.form-group.field")
12
- end
13
-
14
- context "with valid attributes" do
15
- it "credit type" do
16
- fill_in "Name", with: "Credit"
17
- select "Spree::ReimbursementType::Credit", from: "reimbursement_type_type"
18
-
19
- expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)
20
-
21
- expect(page).to have_content("Credit")
22
- end
23
-
24
- it "exchange type" do
25
- fill_in "Name", with: "Exchange"
26
- select "Spree::ReimbursementType::Exchange", from: "reimbursement_type_type"
27
-
28
- expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)
29
-
30
- expect(page).to have_content("Exchange")
31
- end
32
-
33
- it "original payment type" do
34
- fill_in "Name", with: "OriginalPayment"
35
- select "Spree::ReimbursementType::OriginalPayment", from: "reimbursement_type_type"
36
-
37
- expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)
38
-
39
- expect(page).to have_content("OriginalPayment")
40
- end
41
-
42
- it "store credit type" do
43
- fill_in "Name", with: "StoreCredit"
44
- select "Spree::ReimbursementType::StoreCredit", from: "reimbursement_type_type"
45
-
46
- expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)
47
-
48
- expect(page).to have_content("StoreCredit")
49
- end
50
- end
51
-
52
- context "with invalid params" do
53
- it "without name" do
54
- fill_in "Name", with: ""
55
- select "Spree::ReimbursementType::StoreCredit", from: "reimbursement_type_type"
56
-
57
- expect { click_button "Create" }.not_to change(Spree::ReimbursementType, :count)
58
-
59
- expect(page).to have_content("Name can't be blank")
60
- end
61
- end
62
- end
@@ -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