solidus_product_assembly 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,24 +1,25 @@
1
- # Product Assembly
1
+ # Solidus Product Assembly
2
2
 
3
- [![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_product_assembly.svg?style=svg)](https://circleci.com/gh/solidusio-contrib/solidus_product_assembly)
3
+ [![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_product_assembly.svg?style=shield)](https://circleci.com/gh/solidusio-contrib/solidus_product_assembly)
4
+ [![codecov](https://codecov.io/gh/solidusio-contrib/solidus_product_assembly/branch/master/graph/badge.svg)](https://codecov.io/gh/solidusio-contrib/solidus_product_assembly)
4
5
 
5
6
  Create a product which is composed of other products.
6
7
 
7
8
  ## Installation
8
9
 
9
- Add the following line to your `Gemfile`:
10
+ Add solidus_product_assembly to your Gemfile:
10
11
 
11
12
  ```ruby
12
- gem 'solidus_product_assembly', github: 'solidusio-contrib/solidus_product_assembly', branch: 'master'
13
+ gem 'solidus_product_assembly'
13
14
  ```
14
15
 
15
- Run bundle install as well as the extension intall command to copy and run migrations and
16
- append solidus_product_assembly to your js manifest file:
16
+ Bundle your dependencies and run the installation generator:
17
17
 
18
- bundle install
19
- rails g solidus_product_assembly:install
18
+ ```shell
19
+ bin/rails generate solidus_product_assembly:install
20
+ ```
20
21
 
21
- ## Use
22
+ ## Usage
22
23
 
23
24
  To build a bundle (assembly product) you'd need to first check the "Can be part"
24
25
  flag on each product you want to be part of the bundle. Then create a product
@@ -30,85 +31,75 @@ That means you essentially have a product composed of other products. From a
30
31
  customer perspective it's like they are paying a single amount for a collection
31
32
  of products.
32
33
 
33
- ## Releasing a new version
34
+ ## Development
35
+
36
+ ### Testing the extension
34
37
 
35
- #### 1. Bump gem version and push to RubyGems
38
+ First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy
39
+ app if it does not exist, then it will run specs. The dummy app can be regenerated by using
40
+ `bin/rake extension:test_app`.
36
41
 
37
- We use [gem-release](https://github.com/svenfuchs/gem-release) to release this
38
- extension with ease.
42
+ ```shell
43
+ bin/rake
44
+ ```
39
45
 
40
- Supposing you are on the master branch and you are working on a fork of this
41
- extension, `upstream` is the main remote and you have write access to it, you
42
- can simply run:
46
+ To run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run
43
47
 
44
- ```bash
45
- gem bump --version minor --tag --release
48
+ ```shell
49
+ bundle exec rubocop
46
50
  ```
47
51
 
48
- This command will:
52
+ When testing your application's integration with this extension you may use its factories.
53
+ Simply add this require statement to your `spec/spec_helper.rb`:
49
54
 
50
- - bump the gem version to the next minor (changing the `version.rb` file)
51
- - commit the change and push it to upstream master
52
- - create a git tag
53
- - push the tag to the upstream remote
54
- - release the new version on RubyGems
55
+ ```ruby
56
+ require 'solidus_product_assembly/testing_support/factories'
57
+ ```
55
58
 
56
- Or you can run these commands individually:
59
+ Or, if you are using `FactoryBot.definition_file_paths`, you can load Solidus core
60
+ factories along with this extension's factories using this statement:
57
61
 
58
- ```bash
59
- gem bump --version minor
60
- gem tag
61
- gem release
62
+ ```ruby
63
+ SolidusDevSupport::TestingSupport::Factories.load_for(SolidusProductAssembly::Engine)
62
64
  ```
63
65
 
64
- #### 2. Publish the updated CHANGELOG
66
+ ### Running the sandbox
67
+
68
+ To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for
69
+ the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
70
+ `sandbox/bin/rails`.
71
+
72
+ Here's an example:
65
73
 
66
- After the release is done we can generate the updated CHANGELOG
67
- using
68
- [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator)
69
- by running the following command:
74
+ ```
75
+ $ bin/rails server
76
+ => Booting Puma
77
+ => Rails 6.0.2.1 application starting in development
78
+ * Listening on tcp://127.0.0.1:3000
79
+ Use Ctrl-C to stop
80
+ ```
70
81
 
82
+ ### Updating the changelog
71
83
 
72
- ```bash
73
- bundle exec github_changelog_generator solidusio/solidus_auth_devise --token YOUR_GITHUB_TOKEN
74
- git commit -am 'Update CHANGELOG'
75
- git push upstream master
84
+ Before and after releases the changelog should be updated to reflect the up-to-date status of
85
+ the project:
86
+
87
+ ```shell
88
+ bin/rake changelog
89
+ git add CHANGELOG.md
90
+ git commit -m "Update the changelog"
76
91
  ```
77
92
 
93
+ ### Releasing new versions
94
+
95
+ Please refer to the dedicated [page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) on Solidus wiki.
96
+
78
97
  ## Contributing
79
98
 
80
- Spree is an open source project and we encourage contributions. Please see the [Community Guidelines][1] before contributing.
81
-
82
- In the spirit of [free software][2], **everyone** is encouraged to help improve this project.
83
-
84
- Here are some ways *you* can contribute:
85
-
86
- * by using prerelease versions
87
- * by reporting [bugs][3]
88
- * by suggesting new features
89
- * by writing translations
90
- * by writing or editing documentation
91
- * by writing specifications
92
- * by writing code (*no patch is too small*: fix typos, add comments, clean up inconsistent whitespace)
93
- * by refactoring code
94
- * by resolving [issues][3]
95
- * by reviewing patches
96
-
97
- Starting point:
98
-
99
- * Fork the repo
100
- * Clone your repo
101
- * Run `bundle install`
102
- * Run `bundle exec rake test_app` to create the test application in `spec/test_app`
103
- * Make your changes
104
- * Ensure specs pass by running `bundle exec rspec spec`
105
- * Submit your pull request
106
-
107
- Copyright (c) 2014 [Spree Commerce Inc.][4] and [contributors][5], released under the [New BSD License][6]
108
-
109
- [1]: https://solidus.io/community-guidelines/
110
- [2]: http://www.fsf.org/licensing/essays/free-sw.html
111
- [3]: https://github.com/spree/spree-product-assembly/issues
112
- [4]: https://github.com/spree
113
- [5]: https://github.com/spree/spree-product-assembly/graphs/contributors
114
- [6]: https://github.com/spree/spree-product-assembly/blob/master/LICENSE.md
99
+ Spree is an open source project and we encourage contributions. Please see the [Community Guidelines](https://solidus.io/community-guidelines/) before contributing.
100
+
101
+ In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project.
102
+
103
+ ## License
104
+
105
+ Copyright (c) 2014 [Spree Commerce Inc.](https://github.com/spree) and [contributors](https://github.com/spree/spree-product-assembly/graphs/contributors), released under the [New BSD License](LICENSE)
@@ -14,12 +14,25 @@ module SolidusProductAssembly
14
14
 
15
15
  scope :individual_saled, -> { where(individual_sale: true) }
16
16
 
17
- scope :search_can_be_part, ->(query){
18
- not_deleted.available.joins(:master)
19
- .where(arel_table["name"].matches("%#{query}%").or(::Spree::Variant.arel_table["sku"].matches("%#{query}%")))
20
- .where(can_be_part: true)
21
- .limit(30)
22
- }
17
+ if defined?(SolidusGlobalize)
18
+ scope :search_can_be_part, ->(query){
19
+ not_deleted.available.joins(:master)
20
+ .joins(:translations)
21
+ .where(
22
+ ::Spree::Product::Translation.arel_table["name"].matches(query)
23
+ .or(::Spree::Variant.arel_table["sku"].matches(query))
24
+ )
25
+ .where(can_be_part: true)
26
+ .limit(30)
27
+ }
28
+ else
29
+ scope :search_can_be_part, ->(query){
30
+ not_deleted.available.joins(:master)
31
+ .where(arel_table["name"].matches(query).or(::Spree::Variant.arel_table["sku"].matches(query)))
32
+ .where(can_be_part: true)
33
+ .limit(30)
34
+ }
35
+ end
23
36
 
24
37
  validate :assembly_cannot_be_part, if: :assembly?
25
38
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusProductAssembly
4
+ module Spree
5
+ module Stock
6
+ module DifferentiatorDecorator
7
+ def build_missing
8
+ super.tap do
9
+ @missing.delete_if { |k, _v| k.product.assembly? }
10
+ end
11
+ end
12
+
13
+ ::Spree::Stock::Differentiator.prepend self
14
+ end
15
+ end
16
+ end
17
+ end
data/bin/rails CHANGED
@@ -1,15 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # frozen_string_literal: true
4
-
5
- app_root = 'spec/dummy'
6
-
7
- unless File.exist? "#{app_root}/bin/rails"
8
- system "bin/rake", app_root or begin # rubocop:disable Style/AndOr
9
- warn "Automatic creation of the dummy app failed"
10
- exit 1
11
- end
3
+ if %w[g generate].include? ARGV.first
4
+ exec "#{__dir__}/rails-engine", *ARGV
5
+ else
6
+ exec "#{__dir__}/rails-sandbox", *ARGV
12
7
  end
13
-
14
- Dir.chdir app_root
15
- exec 'bin/rails', *ARGV
data/bin/rails-engine ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('..', __dir__)
6
+ ENGINE_PATH = File.expand_path('../lib/solidus_product_assembly/engine', __dir__)
7
+
8
+ # Set up gems listed in the Gemfile.
9
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
10
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
11
+
12
+ require 'rails/all'
13
+ require 'rails/engine/commands'
data/bin/rails-sandbox ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ app_root = 'sandbox'
4
+
5
+ unless File.exist? "#{app_root}/bin/rails"
6
+ warn 'Creating the sandbox app...'
7
+ Dir.chdir "#{__dir__}/.." do
8
+ system "#{__dir__}/sandbox" or begin
9
+ warn 'Automatic creation of the sandbox app failed'
10
+ exit 1
11
+ end
12
+ end
13
+ end
14
+
15
+ Dir.chdir app_root
16
+ exec 'bin/rails', *ARGV
data/bin/rake ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "rubygems"
5
+ require "bundler/setup"
6
+
7
+ load Gem.bin_path("rake", "rake")
data/bin/sandbox ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ case "$DB" in
6
+ postgres|postgresql)
7
+ RAILSDB="postgresql"
8
+ ;;
9
+ mysql)
10
+ RAILSDB="mysql"
11
+ ;;
12
+ sqlite|'')
13
+ RAILSDB="sqlite3"
14
+ ;;
15
+ *)
16
+ echo "Invalid DB specified: $DB"
17
+ exit 1
18
+ ;;
19
+ esac
20
+
21
+ if [ ! -z $SOLIDUS_BRANCH ]
22
+ then
23
+ BRANCH=$SOLIDUS_BRANCH
24
+ else
25
+ BRANCH="master"
26
+ fi
27
+
28
+ extension_name="solidus_product_assembly"
29
+
30
+ # Stay away from the bundler env of the containing extension.
31
+ function unbundled {
32
+ ruby -rbundler -e'b = proc {system *ARGV}; Bundler.respond_to?(:with_unbundled_env) ? Bundler.with_unbundled_env(&b) : Bundler.with_clean_env(&b)' -- $@
33
+ }
34
+
35
+ rm -rf ./sandbox
36
+ unbundled bundle exec rails new sandbox --database="$RAILSDB" \
37
+ --skip-bundle \
38
+ --skip-git \
39
+ --skip-keeps \
40
+ --skip-rc \
41
+ --skip-spring \
42
+ --skip-test \
43
+ --skip-javascript
44
+
45
+ if [ ! -d "sandbox" ]; then
46
+ echo 'sandbox rails application failed'
47
+ exit 1
48
+ fi
49
+
50
+ cd ./sandbox
51
+ cat <<RUBY >> Gemfile
52
+ gem 'solidus', github: 'solidusio/solidus', branch: '$BRANCH'
53
+ gem 'solidus_auth_devise', '>= 2.1.0'
54
+ gem 'rails-i18n'
55
+ gem 'solidus_i18n'
56
+
57
+ gem '$extension_name', path: '..'
58
+
59
+ group :test, :development do
60
+ platforms :mri do
61
+ gem 'pry-byebug'
62
+ end
63
+ end
64
+ RUBY
65
+
66
+ unbundled bundle install --gemfile Gemfile
67
+
68
+ unbundled bundle exec rake db:drop db:create
69
+
70
+ unbundled bundle exec rails generate solidus:install \
71
+ --auto-accept \
72
+ --user_class=Spree::User \
73
+ --enforce_available_locales=true \
74
+ --with-authentication=false \
75
+ --payment-method=none \
76
+ $@
77
+
78
+ unbundled bundle exec rails generate solidus:auth:install
79
+ unbundled bundle exec rails generate ${extension_name}:install
80
+
81
+ echo
82
+ echo "🚀 Sandbox app successfully created for $extension_name!"
83
+ echo "🚀 Using $RAILSDB and Solidus $BRANCH"
84
+ echo "🚀 Use 'export DB=[postgres|mysql|sqlite]' to control the DB adapter"
85
+ echo "🚀 Use 'export SOLIDUS_BRANCH=<BRANCH-NAME>' to control the Solidus version"
86
+ echo "🚀 This app is intended for test purposes."
data/bin/setup CHANGED
@@ -5,4 +5,4 @@ set -vx
5
5
 
6
6
  gem install bundler --conservative
7
7
  bundle update
8
- bundle exec rake clobber
8
+ bin/rake clobber
@@ -4,24 +4,32 @@ module SolidusProductAssembly
4
4
  module Generators
5
5
  class InstallGenerator < Rails::Generators::Base
6
6
  class_option :auto_run_migrations, type: :boolean, default: false
7
+ source_root File.expand_path('templates', __dir__)
7
8
 
8
- def add_migrations
9
- run 'bundle exec rake railties:install:migrations FROM=solidus_product_assembly'
9
+ def copy_initializer
10
+ template 'initializer.rb', 'config/initializers/solidus_product_assembly.rb'
10
11
  end
11
12
 
12
13
  def add_javascripts
13
- append_file(
14
- 'vendor/assets/javascripts/spree/backend/all.js',
15
- "//= require spree/backend/solidus_product_assembly\n"
16
- )
14
+ append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_product_assembly\n"
15
+ append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_product_assembly\n"
16
+ end
17
+
18
+ def add_stylesheets
19
+ inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_product_assembly\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
20
+ inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_product_assembly\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
21
+ end
22
+
23
+ def add_migrations
24
+ run 'bin/rails railties:install:migrations FROM=solidus_product_assembly'
17
25
  end
18
26
 
19
27
  def run_migrations
20
- run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
28
+ run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Layout/LineLength
21
29
  if run_migrations
22
- run 'bundle exec rake db:migrate'
30
+ run 'bin/rails db:migrate'
23
31
  else
24
- puts 'Skipping rake db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
32
+ puts 'Skipping bin/rails db:migrate, don\'t forget to run it!' # rubocop:disable Rails/Output
25
33
  end
26
34
  end
27
35
  end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ SolidusProductAssembly.configure do |config|
4
+ # TODO: Remember to change this with the actual preferences you have implemented!
5
+ # config.sample_preference = 'sample_value'
6
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SolidusProductAssembly
4
+ class Configuration
5
+ # Define here the settings for this extension, e.g.:
6
+ #
7
+ # attr_accessor :my_setting
8
+ end
9
+
10
+ class << self
11
+ def configuration
12
+ @configuration ||= Configuration.new
13
+ end
14
+
15
+ alias config configuration
16
+
17
+ def configure
18
+ yield configuration
19
+ end
20
+ end
21
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/core'
3
+ require 'solidus_core'
4
+ require 'solidus_support'
4
5
 
5
6
  module SolidusProductAssembly
6
7
  class Engine < Rails::Engine
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusProductAssembly
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  require 'solidus_core'
4
4
  require 'solidus_support'
5
+ require 'deface'
6
+
5
7
  require 'solidus_product_assembly/version'
6
8
  require 'solidus_product_assembly/engine'
7
- require 'deface'
9
+ require 'solidus_product_assembly/configuration'
@@ -1,40 +1,41 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $:.push File.expand_path('lib', __dir__)
4
- require 'solidus_product_assembly/version'
3
+ require_relative 'lib/solidus_product_assembly/version'
5
4
 
6
5
  Gem::Specification.new do |s|
7
6
  s.platform = Gem::Platform::RUBY
8
- s.name = 'solidus_product_assembly'
9
- s.version = SolidusProductAssembly::VERSION
10
- s.summary = 'Adds oportunity to make bundle of products to your Spree store'
7
+ s.name = 'solidus_product_assembly'
8
+ s.version = SolidusProductAssembly::VERSION
9
+ s.authors = ['Roman Smirnov']
10
+ s.email = 'roman@railsdog.com'
11
+
12
+ s.summary = 'Adds opportunity to make bundle of products to your Spree store'
11
13
  s.description = s.summary
12
- s.license = 'BSD-3-Clause'
14
+ s.homepage = 'https://solidus.io'
15
+ s.license = 'BSD-3-Clause'
16
+
17
+ s.metadata['homepage_uri'] = s.homepage
18
+ s.metadata['source_code_uri'] = 'https://github.com/solidusio-contrib/solidus_product_assembly'
19
+ s.metadata['changelog_uri'] = 'https://github.com/SuperGoodSoft/solidus_product_assembly/blob/master/CHANGELOG.md'
13
20
 
14
21
  s.required_ruby_version = '>= 2.4'
15
22
 
16
- s.author = 'Roman Smirnov'
17
- s.email = 'roman@railsdog.com'
18
- s.homepage = 'https://solidus.io'
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
19
26
 
20
- s.files = Dir.chdir(File.expand_path(__dir__)) do
21
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
- end
23
- s.test_files = Dir['spec/**/*']
27
+ s.files = files.grep_v(%r{^(test|spec|features)/})
28
+ s.test_files = files.grep(%r{^(test|spec|features)/})
24
29
  s.bindir = "exe"
25
- s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ s.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
26
31
  s.require_paths = ["lib"]
27
32
 
28
- if s.respond_to?(:metadata)
29
- s.metadata["homepage_uri"] = s.homepage if s.homepage
30
- s.metadata["source_code_uri"] = "https://github.com/solidusio-contrib/solidus_product_assembly"
31
- end
32
-
33
- s.add_dependency 'deface'
34
- s.add_dependency 'solidus_core', ['>= 1.0', '< 4']
33
+ s.add_dependency 'solidus_core', ['>= 2.0.0', '< 4']
35
34
  s.add_dependency 'solidus_support', '~> 0.8'
35
+ s.add_dependency 'deface'
36
36
 
37
+ s.add_development_dependency 'solidus_dev_support', '~> 2.5'
37
38
  s.add_development_dependency 'github_changelog_generator'
38
39
  s.add_development_dependency 'selenium-webdriver'
39
- s.add_development_dependency 'solidus_dev_support'
40
+ s.add_development_dependency 'webdrivers'
40
41
  end
@@ -8,6 +8,24 @@ describe Spree::Product do
8
8
  @master_variant = Spree::Variant.where(is_master: true).find_by(product_id: @product.id)
9
9
  end
10
10
 
11
+ describe ".search_can_be_part" do
12
+ subject { described_class.search_can_be_part("matching") }
13
+
14
+ let!(:name_matching_product) { create :product, can_be_part: true, name: "matching" }
15
+ let!(:sku_matching_product) { create :product, can_be_part: true, master: variant }
16
+ let(:variant) { create :master_variant, sku: "matching" }
17
+
18
+ before do
19
+ create :product, can_be_part: false, name: "matching"
20
+ create :product, deleted_at: 1.day.ago, can_be_part: true, name: "matching"
21
+ create :product, can_be_part: true, name: "Something else"
22
+ end
23
+
24
+ it "returns non-deleted products matching the search that can be parts" do
25
+ expect(subject).to contain_exactly(name_matching_product, sku_matching_product)
26
+ end
27
+ end
28
+
11
29
  describe "Spree::Product Assembly" do
12
30
  before do
13
31
  @product = create(:product)
data/spec/spec_helper.rb CHANGED
@@ -1,28 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Configure Rails Environment
4
- ENV['RAILS_ENV'] ||= 'test'
4
+ ENV['RAILS_ENV'] = 'test'
5
5
 
6
6
  # Run Coverage report
7
7
  require 'solidus_dev_support/rspec/coverage'
8
8
 
9
- require File.expand_path('dummy/config/environment.rb', __dir__)
9
+ # Create the dummy app if it's still missing.
10
+ dummy_env = "#{__dir__}/dummy/config/environment.rb"
11
+ system 'bin/rake extension:test_app' unless File.exist? dummy_env
12
+ require dummy_env
10
13
 
11
14
  # Requires factories and other useful helpers defined in spree_core.
12
15
  require 'solidus_dev_support/rspec/feature_helper'
13
16
 
14
- # This will load Solidus Core factories right before the ones defined in
15
- # lib/extension_name/testing_support/factories/*_factory.rb or
16
- # lib/extension_name/testing_support/factories.rb
17
- SolidusDevSupport::TestingSupport::Factories.load_for(SolidusProductAssembly::Engine)
18
-
19
17
  # Requires supporting ruby files with custom matchers and macros, etc,
20
18
  # in spec/support/ and its subdirectories.
21
- Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
19
+ Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f }
20
+
21
+ # Requires factories defined in lib/solidus_product_assembly/testing_support/factories.rb
22
+ SolidusDevSupport::TestingSupport::Factories.load_for(SolidusProductAssembly::Engine)
22
23
 
23
24
  RSpec.configure do |config|
24
25
  config.infer_spec_type_from_file_location!
25
26
  config.use_transactional_fixtures = false
27
+
28
+ if Spree.solidus_gem_version < Gem::Version.new('2.11')
29
+ config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :system
30
+ end
26
31
  end
27
32
 
28
33
  Capybara.javascript_driver = (ENV['CAPYBARA_DRIVER'] || :selenium_headless).to_sym