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,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Cancelling + Resuming", :type => :feature do
|
4
|
-
|
5
|
-
stub_authorization!
|
6
|
-
|
7
|
-
let(:user) { build_stubbed(:user, id: 123, spree_api_key: 'fake') }
|
8
|
-
|
9
|
-
before do
|
10
|
-
allow(user).to receive(:has_spree_role?).and_return(true)
|
11
|
-
allow_any_instance_of(Spree::Admin::BaseController).to receive(:try_spree_current_user).and_return(user)
|
12
|
-
end
|
13
|
-
|
14
|
-
let(:order) do
|
15
|
-
order = create(:order)
|
16
|
-
order.update_columns({
|
17
|
-
:state => 'complete',
|
18
|
-
:completed_at => Time.now
|
19
|
-
})
|
20
|
-
order
|
21
|
-
end
|
22
|
-
|
23
|
-
it "can cancel an order" do
|
24
|
-
visit spree.edit_admin_order_path(order.number)
|
25
|
-
click_button 'cancel'
|
26
|
-
within(".additional-info") do
|
27
|
-
within(".state") do
|
28
|
-
expect(page).to have_content("canceled")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
context "with a cancelled order" do
|
34
|
-
before do
|
35
|
-
order.update_column(:state, 'canceled')
|
36
|
-
end
|
37
|
-
|
38
|
-
it "can resume an order" do
|
39
|
-
visit spree.edit_admin_order_path(order.number)
|
40
|
-
click_button 'resume'
|
41
|
-
within(".additional-info") do
|
42
|
-
within(".state") do
|
43
|
-
expect(page).to have_content("resumed")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Cancelling inventory" do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:order) do
|
7
|
-
create(
|
8
|
-
:order_ready_to_ship,
|
9
|
-
number: "R100",
|
10
|
-
state: "complete",
|
11
|
-
line_items_count: 1,
|
12
|
-
)
|
13
|
-
end
|
14
|
-
|
15
|
-
def visit_order
|
16
|
-
visit spree.admin_path
|
17
|
-
click_link "Orders"
|
18
|
-
within_row(1) do
|
19
|
-
click_link "R100"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "when some inventory is cancelable" do
|
24
|
-
it "can cancel the inventory" do
|
25
|
-
visit_order
|
26
|
-
|
27
|
-
click_link 'Cancel Inventory'
|
28
|
-
|
29
|
-
within_row(1) do
|
30
|
-
check 'inventory_unit_ids[]'
|
31
|
-
end
|
32
|
-
|
33
|
-
click_button "Cancel Inventory"
|
34
|
-
expect(page).to have_content("Inventory canceled")
|
35
|
-
expect(page).to have_content("1 x canceled")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context "when all inventory is not cancelable" do
|
40
|
-
before { order.inventory_units.each(&:cancel!) }
|
41
|
-
|
42
|
-
it "does not display the link to cancel inventory" do
|
43
|
-
visit_order
|
44
|
-
|
45
|
-
expect(page).to have_no_content('Cancel Inventory')
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,163 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Customer Details", type: :feature, js: true do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let(:country) { create(:country, name: "Kangaland") }
|
7
|
-
let(:state) { create(:state, name: "Alabama", country: country) }
|
8
|
-
let!(:shipping_method) { create(:shipping_method, display_on: "front_end") }
|
9
|
-
let!(:order) { create(:order, state: 'complete', completed_at: "2011-02-01 12:36:15") }
|
10
|
-
let!(:product) { create(:product_in_stock) }
|
11
|
-
|
12
|
-
# We need a unique name that will appear for the customer dropdown
|
13
|
-
let!(:ship_address) { create(:address, country: country, state: state, first_name: "Rumpelstiltskin") }
|
14
|
-
let!(:bill_address) { create(:address, country: country, state: state, first_name: "Rumpelstiltskin") }
|
15
|
-
|
16
|
-
let!(:user) { create(:user, email: 'foobar@example.com', ship_address: ship_address, bill_address: bill_address) }
|
17
|
-
|
18
|
-
context "brand new order" do
|
19
|
-
# Regression test for #3335 & #5317
|
20
|
-
it "associates a user when not using guest checkout" do
|
21
|
-
visit spree.admin_path
|
22
|
-
click_link "Orders"
|
23
|
-
click_link "New Order"
|
24
|
-
click_on 'Cart'
|
25
|
-
select2_search product.name, from: Spree.t(:name_or_sku)
|
26
|
-
within("table.stock-levels") do
|
27
|
-
find('.variant_quantity').set(1)
|
28
|
-
end
|
29
|
-
click_icon :plus
|
30
|
-
expect(page).to have_css('.line-item')
|
31
|
-
click_link "Customer Details"
|
32
|
-
targetted_select2 "foobar@example.com", from: "#s2id_customer_search"
|
33
|
-
# 5317 - Address prefills using user's default.
|
34
|
-
expect(page).to have_field('First Name', with: user.bill_address.firstname)
|
35
|
-
expect(page).to have_field('Last Name', with: user.bill_address.lastname)
|
36
|
-
expect(page).to have_field('Street Address', with: user.bill_address.address1)
|
37
|
-
expect(page).to have_field("Street Address (cont'd)", with: user.bill_address.address2)
|
38
|
-
expect(page).to have_field('City', with: user.bill_address.city)
|
39
|
-
expect(page).to have_field('Zip', with: user.bill_address.zipcode)
|
40
|
-
expect(page).to have_field('Country', with: user.bill_address.country_id)
|
41
|
-
expect(page).to have_field('State', with: user.bill_address.state_id)
|
42
|
-
expect(page).to have_field('Phone', with: user.bill_address.phone)
|
43
|
-
click_button "Update"
|
44
|
-
expect(Spree::Order.last.user).not_to be_nil
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context "editing an order" do
|
49
|
-
before do
|
50
|
-
configure_spree_preferences do |config|
|
51
|
-
config.default_country_id = country.id
|
52
|
-
config.company = true
|
53
|
-
end
|
54
|
-
|
55
|
-
visit spree.admin_path
|
56
|
-
click_link "Orders"
|
57
|
-
within('table#listing_orders') { click_icon(:edit) }
|
58
|
-
end
|
59
|
-
|
60
|
-
context "selected country has no state" do
|
61
|
-
before { create(:country, iso: "BRA", name: "Brazil") }
|
62
|
-
|
63
|
-
it "changes state field to text input" do
|
64
|
-
click_link "Customer Details"
|
65
|
-
|
66
|
-
within("#billing") do
|
67
|
-
targetted_select2 "Brazil", from: "#s2id_order_bill_address_attributes_country_id"
|
68
|
-
fill_in "order_bill_address_attributes_state_name", with: "Piaui"
|
69
|
-
end
|
70
|
-
|
71
|
-
click_button "Update"
|
72
|
-
click_link "Customer Details"
|
73
|
-
expect(find_field("order_bill_address_attributes_state_name").value).to eq("Piaui")
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should be able to update customer details for an existing order" do
|
78
|
-
order.ship_address = create(:address)
|
79
|
-
order.save!
|
80
|
-
|
81
|
-
click_link "Customer Details"
|
82
|
-
within("#shipping") { fill_in_address "ship" }
|
83
|
-
within("#billing") { fill_in_address "bill" }
|
84
|
-
|
85
|
-
click_button "Update"
|
86
|
-
click_link "Customer Details"
|
87
|
-
|
88
|
-
# Regression test for #2950 + #2433
|
89
|
-
# This act should transition the state of the order as far as it will go too
|
90
|
-
within("#order_tab_summary") do
|
91
|
-
expect(find(".state").text).to eq("COMPLETE")
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
it "should show validation errors" do
|
96
|
-
order.update_attributes!(ship_address_id: nil)
|
97
|
-
click_link "Customer Details"
|
98
|
-
click_button "Update"
|
99
|
-
expect(page).to have_content("Shipping address first name can't be blank")
|
100
|
-
end
|
101
|
-
|
102
|
-
it "updates order email for an existing order with a user" do
|
103
|
-
order.update_columns(ship_address_id: ship_address.id, bill_address_id: bill_address.id, state: "confirm", completed_at: nil)
|
104
|
-
previous_user = order.user
|
105
|
-
click_link "Customer Details"
|
106
|
-
fill_in "order_email", with: "newemail@example.com"
|
107
|
-
expect { click_button "Update" }.to change { order.reload.email }.to "newemail@example.com"
|
108
|
-
expect(order.user_id).to eq previous_user.id
|
109
|
-
expect(order.user.email).to eq previous_user.email
|
110
|
-
end
|
111
|
-
|
112
|
-
context "country associated was removed" do
|
113
|
-
let(:brazil) { create(:country, iso: "BRA", name: "Brazil") }
|
114
|
-
|
115
|
-
before do
|
116
|
-
order.bill_address.country.destroy
|
117
|
-
configure_spree_preferences do |config|
|
118
|
-
config.default_country_id = brazil.id
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
it "sets default country when displaying form" do
|
123
|
-
click_link "Customer Details"
|
124
|
-
expect(find_field("order_bill_address_attributes_country_id").value.to_i).to eq brazil.id
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
# Regression test for #942
|
129
|
-
context "errors when no shipping methods are available" do
|
130
|
-
before do
|
131
|
-
Spree::ShippingMethod.delete_all
|
132
|
-
end
|
133
|
-
|
134
|
-
specify do
|
135
|
-
click_link "Customer Details"
|
136
|
-
# Need to fill in valid information so it passes validations
|
137
|
-
fill_in "order_ship_address_attributes_firstname", with: "John 99"
|
138
|
-
fill_in "order_ship_address_attributes_lastname", with: "Doe"
|
139
|
-
fill_in "order_ship_address_attributes_lastname", with: "Company"
|
140
|
-
fill_in "order_ship_address_attributes_address1", with: "100 first lane"
|
141
|
-
fill_in "order_ship_address_attributes_address2", with: "#101"
|
142
|
-
fill_in "order_ship_address_attributes_city", with: "Bethesda"
|
143
|
-
fill_in "order_ship_address_attributes_zipcode", with: "20170"
|
144
|
-
|
145
|
-
page.select('Alabama', from: 'order_ship_address_attributes_state_id')
|
146
|
-
fill_in "order_ship_address_attributes_phone", with: "123-456-7890"
|
147
|
-
expect { click_button "Update" }.not_to raise_error
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
def fill_in_address(kind = "bill")
|
153
|
-
fill_in "First Name", with: "John 99"
|
154
|
-
fill_in "Last Name", with: "Doe"
|
155
|
-
fill_in "Company", with: "Company"
|
156
|
-
fill_in "Street Address", with: "100 first lane"
|
157
|
-
fill_in "Street Address (cont'd)", with: "#101"
|
158
|
-
fill_in "City", with: "Bethesda"
|
159
|
-
fill_in "Zip", with: "20170"
|
160
|
-
targetted_select2 "Alabama", from: "#s2id_order_#{kind}_address_attributes_state_id"
|
161
|
-
fill_in "Phone", with: "123-456-7890"
|
162
|
-
end
|
163
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Tests for #3958's features
|
4
|
-
describe "Order Line Items", type: :feature, js: true do
|
5
|
-
stub_authorization!
|
6
|
-
|
7
|
-
before do
|
8
|
-
# Removing the delivery step causes the order page to render a different
|
9
|
-
# partial, called _line_items, which shows line items rather than shipments
|
10
|
-
allow(Spree::Order).to receive_messages :checkout_step_names => [:address, :payment, :confirm, :complete]
|
11
|
-
end
|
12
|
-
|
13
|
-
let!(:order) do
|
14
|
-
order = create(:order_with_line_items, :line_items_count => 1)
|
15
|
-
order.shipments.destroy_all
|
16
|
-
order
|
17
|
-
end
|
18
|
-
|
19
|
-
it "can edit a line item's quantity" do
|
20
|
-
visit spree.edit_admin_order_path(order)
|
21
|
-
within(".line-items") do
|
22
|
-
find(".edit-line-item").click
|
23
|
-
fill_in "quantity", :with => 10
|
24
|
-
find(".save-line-item").click
|
25
|
-
end
|
26
|
-
within '.line-item-qty-show' do
|
27
|
-
expect(page).to have_content("10")
|
28
|
-
end
|
29
|
-
within '.line-item-total' do
|
30
|
-
expect(page).to have_content("$100.00")
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
it "can delete a line item" do
|
35
|
-
visit spree.edit_admin_order_path(order)
|
36
|
-
|
37
|
-
product_name = find(".line-items tr:nth-child(1) .line-item-name").text
|
38
|
-
|
39
|
-
within(".line-items") do
|
40
|
-
within_row(1) do
|
41
|
-
accept_alert do
|
42
|
-
find(".delete-line-item").click
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
expect(find('#order_total')).to have_content("$0.00")
|
48
|
-
expect(page).not_to have_content(product_name)
|
49
|
-
end
|
50
|
-
end
|
@@ -1,130 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Orders Listing", type: :feature, js: true do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:promotion) { create(:promotion_with_item_adjustment, code: "vnskseiw") }
|
7
|
-
let(:promotion_code) { promotion.codes.first }
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
allow_any_instance_of(Spree::OrderInventory).to receive(:add_to_shipment)
|
11
|
-
@order1 = create(:order_with_line_items, created_at: 1.day.from_now, completed_at: 1.day.from_now, number: "R100")
|
12
|
-
@order2 = create(:order, created_at: 1.day.ago, completed_at: 1.day.ago, number: "R200")
|
13
|
-
visit spree.admin_orders_path
|
14
|
-
end
|
15
|
-
|
16
|
-
context "listing orders" do
|
17
|
-
it "should list existing orders" do
|
18
|
-
within_row(1) do
|
19
|
-
expect(column_text(2)).to eq "R100"
|
20
|
-
expect(column_text(3)).to eq "CART"
|
21
|
-
end
|
22
|
-
|
23
|
-
within_row(2) do
|
24
|
-
expect(column_text(2)).to eq "R200"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should be able to sort the orders listing" do
|
29
|
-
# default is completed_at desc
|
30
|
-
within_row(1) { expect(page).to have_content("R100") }
|
31
|
-
within_row(2) { expect(page).to have_content("R200") }
|
32
|
-
|
33
|
-
click_link "Completed At"
|
34
|
-
|
35
|
-
# Completed at desc
|
36
|
-
within_row(1) { expect(page).to have_content("R200") }
|
37
|
-
within_row(2) { expect(page).to have_content("R100") }
|
38
|
-
|
39
|
-
within('table#listing_orders thead') { click_link "Number" }
|
40
|
-
|
41
|
-
# number asc
|
42
|
-
within_row(1) { expect(page).to have_content("R100") }
|
43
|
-
within_row(2) { expect(page).to have_content("R200") }
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context "searching orders" do
|
48
|
-
it "should be able to search orders" do
|
49
|
-
click_on 'Filter'
|
50
|
-
fill_in "q_number_cont", with: "R200"
|
51
|
-
click_on 'Filter Results'
|
52
|
-
within_row(1) do
|
53
|
-
expect(page).to have_content("R200")
|
54
|
-
end
|
55
|
-
|
56
|
-
# Ensure that the other order doesn't show up
|
57
|
-
within("table#listing_orders") { expect(page).not_to have_content("R100") }
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should be able to filter on variant_id" do
|
61
|
-
click_on 'Filter'
|
62
|
-
select2_search @order1.products.first.sku, from: Spree.t(:variant)
|
63
|
-
click_on 'Filter Results'
|
64
|
-
|
65
|
-
within_row(1) do
|
66
|
-
expect(page).to have_content(@order1.number)
|
67
|
-
end
|
68
|
-
|
69
|
-
expect(page).not_to have_content(@order2.number)
|
70
|
-
end
|
71
|
-
|
72
|
-
context "when pagination is really short" do
|
73
|
-
before do
|
74
|
-
@old_per_page = Spree::Config[:orders_per_page]
|
75
|
-
Spree::Config[:orders_per_page] = 1
|
76
|
-
end
|
77
|
-
|
78
|
-
after do
|
79
|
-
Spree::Config[:orders_per_page] = @old_per_page
|
80
|
-
end
|
81
|
-
|
82
|
-
# Regression test for #4004
|
83
|
-
it "should be able to go from page to page for incomplete orders" do
|
84
|
-
10.times { Spree::Order.create email: "incomplete@example.com" }
|
85
|
-
click_on 'Filter'
|
86
|
-
uncheck "q_completed_at_not_null"
|
87
|
-
click_on 'Filter Results'
|
88
|
-
within(".pagination") do
|
89
|
-
click_link "2"
|
90
|
-
end
|
91
|
-
expect(page).to have_content("incomplete@example.com")
|
92
|
-
click_on 'Filter'
|
93
|
-
expect(find("#q_completed_at_not_null")).not_to be_checked
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
it "should be able to search orders using only completed at input" do
|
98
|
-
click_on 'Filter'
|
99
|
-
fill_in "q_created_at_gt", with: Date.current
|
100
|
-
|
101
|
-
# Just so the datepicker gets out of poltergeists way.
|
102
|
-
page.execute_script("$('#q_created_at_gt').datepicker('widget').hide();")
|
103
|
-
|
104
|
-
click_on 'Filter Results'
|
105
|
-
within_row(1) { expect(page).to have_content("R100") }
|
106
|
-
|
107
|
-
# Ensure that the other order doesn't show up
|
108
|
-
within("table#listing_orders") { expect(page).not_to have_content("R200") }
|
109
|
-
end
|
110
|
-
|
111
|
-
context "filter on promotions" do
|
112
|
-
before(:each) do
|
113
|
-
@order1.order_promotions.build(
|
114
|
-
promotion: promotion,
|
115
|
-
promotion_code: promotion_code,
|
116
|
-
)
|
117
|
-
@order1.save
|
118
|
-
visit spree.admin_orders_path
|
119
|
-
end
|
120
|
-
|
121
|
-
it "only shows the orders with the selected promotion" do
|
122
|
-
click_on 'Filter'
|
123
|
-
fill_in "q_promotions_codes_value_cont", with: promotion.codes.first.value
|
124
|
-
click_on 'Filter Results'
|
125
|
-
within_row(1) { expect(page).to have_content("R100") }
|
126
|
-
within("table#listing_orders") { expect(page).not_to have_content("R200") }
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Log entries", :type => :feature do
|
4
|
-
stub_authorization!
|
5
|
-
|
6
|
-
let!(:payment) { create(:payment) }
|
7
|
-
|
8
|
-
context "with a successful log entry" do
|
9
|
-
before do
|
10
|
-
response = ActiveMerchant::Billing::Response.new(
|
11
|
-
true,
|
12
|
-
"Transaction successful",
|
13
|
-
:transid => "ABCD1234"
|
14
|
-
)
|
15
|
-
|
16
|
-
payment.log_entries.create(
|
17
|
-
:source => payment.source,
|
18
|
-
:details => response.to_yaml
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "shows a successful attempt" do
|
23
|
-
visit spree.admin_order_payments_path(payment.order)
|
24
|
-
find("#payment_#{payment.id} a").click
|
25
|
-
click_link "Logs"
|
26
|
-
within("#listing_log_entries") do
|
27
|
-
expect(page).to have_content("Transaction successful")
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context "with a failed log entry" do
|
33
|
-
before do
|
34
|
-
response = ActiveMerchant::Billing::Response.new(
|
35
|
-
false,
|
36
|
-
"Transaction failed",
|
37
|
-
:transid => "ABCD1234"
|
38
|
-
)
|
39
|
-
|
40
|
-
payment.log_entries.create(
|
41
|
-
:source => payment.source,
|
42
|
-
:details => response.to_yaml
|
43
|
-
)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "shows a failed attempt" do
|
47
|
-
visit spree.admin_order_payments_path(payment.order)
|
48
|
-
find("#payment_#{payment.id} a").click
|
49
|
-
click_link "Logs"
|
50
|
-
within("#listing_log_entries") do
|
51
|
-
expect(page).to have_content("Transaction failed")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|