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,30 +0,0 @@
|
|
1
|
-
# coding: UTF-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe Spree::Admin::StockMovementsHelper, :type => :helper do
|
5
|
-
|
6
|
-
describe "#pretty_originator" do
|
7
|
-
|
8
|
-
context "transfering between two locations" do
|
9
|
-
let(:destination_location) { create(:stock_location_with_items) }
|
10
|
-
let(:source_location) { create(:stock_location_with_items) }
|
11
|
-
let(:stock_item) { source_location.stock_items.order(:id).first }
|
12
|
-
let(:variant) { stock_item.variant }
|
13
|
-
|
14
|
-
before do
|
15
|
-
@stock_transfer = Spree::StockTransfer.create(reference: 'PO123')
|
16
|
-
variants = { variant => 5 }
|
17
|
-
@stock_transfer.transfer(source_location,
|
18
|
-
destination_location,
|
19
|
-
variants)
|
20
|
-
helper.pretty_originator(@stock_transfer.stock_movements.last)
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
it "returns link to stock transfer" do
|
25
|
-
expect(helper.pretty_originator(@stock_transfer.stock_movements.last)).to eq @stock_transfer.number
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
module Spree
|
3
|
-
describe Spree::PromotionRulesHelper, :type => :helper do
|
4
|
-
it "does not include existing rules in options" do
|
5
|
-
promotion = Spree::Promotion.new
|
6
|
-
promotion.promotion_rules << Spree::Promotion::Rules::ItemTotal.new
|
7
|
-
|
8
|
-
options = helper.options_for_promotion_rule_types(promotion)
|
9
|
-
expect(options).not_to match(/ItemTotal/)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Spree
|
4
|
-
class Test
|
5
|
-
end
|
6
|
-
module Submodule
|
7
|
-
class Test
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
module Spree
|
13
|
-
module Admin
|
14
|
-
describe Resource, type: :model do
|
15
|
-
let(:resource_base) { Resource.new('spree/admin/test', 'test', 'widget') }
|
16
|
-
let(:resource_submodule) { Resource.new('spree/admin/submodule/test', 'test', 'widget') }
|
17
|
-
let(:resource_object_name) { Resource.new('spree/admin/test', 'test', 'gadget', 'widget') }
|
18
|
-
|
19
|
-
it "can get base model class" do
|
20
|
-
expect(resource_base.model_class).to eq(Spree::Test)
|
21
|
-
end
|
22
|
-
|
23
|
-
it "can get submodule class" do
|
24
|
-
expect(resource_submodule.model_class).to eq(Spree::Submodule::Test)
|
25
|
-
end
|
26
|
-
|
27
|
-
it "can get base model name (only used for parent)" do
|
28
|
-
expect(resource_base.model_name).to eq('widget')
|
29
|
-
end
|
30
|
-
|
31
|
-
it "can get submodule model name (only used for parent)" do
|
32
|
-
expect(resource_submodule.model_name).to eq('widget')
|
33
|
-
end
|
34
|
-
|
35
|
-
it "can get base object name" do
|
36
|
-
expect(resource_base.object_name).to eq('test')
|
37
|
-
end
|
38
|
-
|
39
|
-
it "can get submodule object name" do
|
40
|
-
expect(resource_submodule.object_name).to eq('submodule_test')
|
41
|
-
end
|
42
|
-
|
43
|
-
it "can get overridden object name" do
|
44
|
-
expect(resource_object_name.object_name).to eq('widget')
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Spree
|
4
|
-
module Admin
|
5
|
-
RSpec.describe "AdminPath", type: :routing do
|
6
|
-
it "shoud route to admin by default" do
|
7
|
-
expect(spree.admin_path).to eq("/admin")
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should route to the the configured path" do
|
11
|
-
Spree.admin_path = "/secret"
|
12
|
-
Rails.application.reload_routes!
|
13
|
-
expect(spree.admin_path).to eq("/secret")
|
14
|
-
|
15
|
-
# restore the path for other tests
|
16
|
-
Spree.admin_path = "/admin"
|
17
|
-
Rails.application.reload_routes!
|
18
|
-
expect(spree.admin_path).to eq("/admin")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,134 +0,0 @@
|
|
1
|
-
if ENV["COVERAGE"]
|
2
|
-
# Run Coverage report
|
3
|
-
require 'simplecov'
|
4
|
-
SimpleCov.start do
|
5
|
-
add_group 'Controllers', 'app/controllers'
|
6
|
-
add_group 'Helpers', 'app/helpers'
|
7
|
-
add_group 'Mailers', 'app/mailers'
|
8
|
-
add_group 'Models', 'app/models'
|
9
|
-
add_group 'Views', 'app/views'
|
10
|
-
add_group 'Libraries', 'lib'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
15
|
-
# from the project root directory.
|
16
|
-
ENV["RAILS_ENV"] ||= 'test'
|
17
|
-
|
18
|
-
begin
|
19
|
-
require File.expand_path("../dummy/config/environment", __FILE__)
|
20
|
-
rescue LoadError
|
21
|
-
puts "Could not load dummy application. Please ensure you have run `bundle exec rake test_app`"
|
22
|
-
exit
|
23
|
-
end
|
24
|
-
|
25
|
-
require 'rspec/rails'
|
26
|
-
|
27
|
-
# Requires supporting files with custom matchers and macros, etc,
|
28
|
-
# in ./support/ and its subdirectories.
|
29
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
30
|
-
|
31
|
-
require 'database_cleaner'
|
32
|
-
require 'ffaker'
|
33
|
-
require 'timeout'
|
34
|
-
|
35
|
-
require 'spree/testing_support/authorization_helpers'
|
36
|
-
require 'spree/testing_support/factories'
|
37
|
-
require 'spree/testing_support/preferences'
|
38
|
-
require 'spree/testing_support/controller_requests'
|
39
|
-
require 'spree/testing_support/flash'
|
40
|
-
require 'spree/testing_support/url_helpers'
|
41
|
-
require 'spree/testing_support/order_walkthrough'
|
42
|
-
require 'spree/testing_support/capybara_ext'
|
43
|
-
require 'spree/testing_support/shoulda_matcher_configuration'
|
44
|
-
|
45
|
-
require 'paperclip/matchers'
|
46
|
-
|
47
|
-
require 'capybara-screenshot/rspec'
|
48
|
-
Capybara.save_and_open_page_path = ENV['CIRCLE_ARTIFACTS'] if ENV['CIRCLE_ARTIFACTS']
|
49
|
-
|
50
|
-
require 'capybara/poltergeist'
|
51
|
-
Capybara.javascript_driver = :poltergeist
|
52
|
-
|
53
|
-
# Set timeout to something high enough to allow CI to pass
|
54
|
-
Capybara.default_max_wait_time = 10
|
55
|
-
|
56
|
-
RSpec.configure do |config|
|
57
|
-
config.color = true
|
58
|
-
config.fail_fast = ENV['FAIL_FAST'] || false
|
59
|
-
config.infer_spec_type_from_file_location!
|
60
|
-
config.mock_with :rspec
|
61
|
-
config.raise_errors_for_deprecations!
|
62
|
-
|
63
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
64
|
-
# examples within a transaction, comment the following line or assign false
|
65
|
-
# instead of true.
|
66
|
-
config.use_transactional_fixtures = false
|
67
|
-
|
68
|
-
config.before :suite do
|
69
|
-
Capybara.match = :prefer_exact
|
70
|
-
DatabaseCleaner.clean_with :truncation
|
71
|
-
end
|
72
|
-
|
73
|
-
config.before(:each) do
|
74
|
-
Rails.cache.clear
|
75
|
-
WebMock.disable!
|
76
|
-
if RSpec.current_example.metadata[:js]
|
77
|
-
DatabaseCleaner.strategy = :truncation
|
78
|
-
else
|
79
|
-
DatabaseCleaner.strategy = :transaction
|
80
|
-
end
|
81
|
-
# TODO: Find out why open_transactions ever gets below 0
|
82
|
-
# See issue #3428
|
83
|
-
if ActiveRecord::Base.connection.open_transactions < 0
|
84
|
-
ActiveRecord::Base.connection.increment_open_transactions
|
85
|
-
end
|
86
|
-
|
87
|
-
DatabaseCleaner.start
|
88
|
-
reset_spree_preferences
|
89
|
-
end
|
90
|
-
|
91
|
-
config.after(:each) do
|
92
|
-
# Ensure js requests finish processing before advancing to the next test
|
93
|
-
wait_for_ajax if RSpec.current_example.metadata[:js]
|
94
|
-
|
95
|
-
DatabaseCleaner.clean
|
96
|
-
end
|
97
|
-
|
98
|
-
config.around do |example|
|
99
|
-
Timeout.timeout(30, &example)
|
100
|
-
end
|
101
|
-
|
102
|
-
config.after(:each, :type => :feature) do |example|
|
103
|
-
missing_translations = page.body.scan(/translation missing: #{I18n.locale}\.(.*?)[\s<\"&]/)
|
104
|
-
if missing_translations.any?
|
105
|
-
puts "Found missing translations: #{missing_translations.inspect}"
|
106
|
-
puts "In spec: #{example.location}"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
config.include FactoryGirl::Syntax::Methods
|
111
|
-
|
112
|
-
config.include Spree::TestingSupport::Preferences
|
113
|
-
config.include Spree::TestingSupport::UrlHelpers
|
114
|
-
config.include Spree::TestingSupport::ControllerRequests, type: :controller
|
115
|
-
config.include Spree::TestingSupport::Flash
|
116
|
-
|
117
|
-
config.include Paperclip::Shoulda::Matchers
|
118
|
-
|
119
|
-
config.extend WithModel
|
120
|
-
end
|
121
|
-
|
122
|
-
module Spree
|
123
|
-
module TestingSupport
|
124
|
-
module Flash
|
125
|
-
def assert_flash_success(flash)
|
126
|
-
flash = convert_flash(flash)
|
127
|
-
|
128
|
-
within(".alert-success") do
|
129
|
-
expect(page).to have_content(flash)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
edit
|
@@ -1 +0,0 @@
|
|
1
|
-
new
|
@@ -1 +0,0 @@
|
|
1
|
-
edit
|
@@ -1 +0,0 @@
|
|
1
|
-
new
|