solidus_dev_support 2.3.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58949d06dbd9443030d57e6f70894aed059f00684f865d7f0b7b631590adddc8
4
- data.tar.gz: 2963edee739c9fd30df63e896a1794f5765e2cb6f243e2093d59c9a3458224aa
3
+ metadata.gz: 72a33b9cca402cd6724c7b9c95cfc826dc4bc011272654a67a72487a43eb8936
4
+ data.tar.gz: 77725ac4faffd63e4b480d2d5964a1084c09eac6c1350d5b08fc15c4e9ad615b
5
5
  SHA512:
6
- metadata.gz: e0a31ee39a78e7738f12a17d1cb0e75fe66e70a6249027f540f28c488ea3a21f826e6631b5233792b6b18f4802cc98dd86fbd6cab4bf39611f18acc8911f5ae8
7
- data.tar.gz: 620fc9ec7cb78af1bd94ea12da18cb3452db2a6114e81b58d7e7f2bad46bd5744f3f18b6800d06d55b353bc65354fa8d054c5ebcc5e328f8dc1617e5962b8f58
6
+ metadata.gz: 0f87121188ad5f7d5046e2d4f1f6172ed9cedc4f70dbd66ee648d97bfcac55765be764db8afcc154fc98209e15c6efbf92fcaf082263bd341b5a439dd04c13ef
7
+ data.tar.gz: 9a4d51ae3458794ff639f7a990a8d5b1e4df0548889b67bc3a2c5228d6fa3db5e5bde9ca938fa367e680d0aff0202a725b2bf604715a494a8b13d5dde956b901
data/CHANGELOG.md CHANGED
@@ -1,8 +1,59 @@
1
1
  # Changelog
2
2
 
3
- ## [2.3.0](https://github.com/solidusio/solidus_dev_support/tree/2.3.0) (2021-01-14)
3
+ ## [v2.5.0](https://github.com/solidusio/solidus_dev_support/tree/v2.5.0) (2021-04-20)
4
4
 
5
- [Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.2.0...2.3.0)
5
+ [Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.4.3...v2.5.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Allow Solidus 3 [\#176](https://github.com/solidusio/solidus_dev_support/pull/176) ([kennyadsl](https://github.com/kennyadsl))
10
+ - Relax Ruby version requirement [\#174](https://github.com/solidusio/solidus_dev_support/pull/174) ([gauravtiwari](https://github.com/gauravtiwari))
11
+
12
+ ## [v2.4.3](https://github.com/solidusio/solidus_dev_support/tree/v2.4.3) (2021-02-23)
13
+
14
+ [Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.4.2...v2.4.3)
15
+
16
+ **Implemented enhancements:**
17
+
18
+ - Add instruction on how to use the new factories in apps [\#172](https://github.com/solidusio/solidus_dev_support/pull/172) ([kennyadsl](https://github.com/kennyadsl))
19
+
20
+ **Fixed bugs:**
21
+
22
+ - Explode directories into individual files [\#171](https://github.com/solidusio/solidus_dev_support/pull/171) ([kennyadsl](https://github.com/kennyadsl))
23
+ - Fix factories loading, part 2 [\#170](https://github.com/solidusio/solidus_dev_support/pull/170) ([kennyadsl](https://github.com/kennyadsl))
24
+
25
+ ## [v2.4.2](https://github.com/solidusio/solidus_dev_support/tree/v2.4.2) (2021-02-19)
26
+
27
+ [Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.4.1...v2.4.2)
28
+
29
+ ## [v2.4.1](https://github.com/solidusio/solidus_dev_support/tree/v2.4.1) (2021-02-19)
30
+
31
+ [Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.4.0...v2.4.1)
32
+
33
+ **Fixed bugs:**
34
+
35
+ - Fix loading factories in extensions after the last changes in Solidus [\#169](https://github.com/solidusio/solidus_dev_support/pull/169) ([kennyadsl](https://github.com/kennyadsl))
36
+
37
+ ## [v2.4.0](https://github.com/solidusio/solidus_dev_support/tree/v2.4.0) (2021-02-05)
38
+
39
+ [Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.3.0...v2.4.0)
40
+
41
+ **Implemented enhancements:**
42
+
43
+ - Improve engine's requires to remove double inclusions [\#165](https://github.com/solidusio/solidus_dev_support/pull/165) ([kennyadsl](https://github.com/kennyadsl))
44
+ - Remove double require of core factories from rails\_helper [\#164](https://github.com/solidusio/solidus_dev_support/pull/164) ([kennyadsl](https://github.com/kennyadsl))
45
+
46
+ **Fixed bugs:**
47
+
48
+ - Fix typo in configuration.rb.tt [\#166](https://github.com/solidusio/solidus_dev_support/pull/166) ([brchristian](https://github.com/brchristian))
49
+
50
+ **Merged pull requests:**
51
+
52
+ - Rename spree:install to solidus:install in the sandbox template [\#167](https://github.com/solidusio/solidus_dev_support/pull/167) ([blocknotes](https://github.com/blocknotes))
53
+
54
+ ## [v2.3.0](https://github.com/solidusio/solidus_dev_support/tree/v2.3.0) (2021-01-14)
55
+
56
+ [Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.2.0...v2.3.0)
6
57
 
7
58
  **Implemented enhancements:**
8
59
 
@@ -40,7 +91,7 @@
40
91
  **Implemented enhancements:**
41
92
 
42
93
  - Add standard github\_changelog\_generator configuration [\#151](https://github.com/solidusio/solidus_dev_support/pull/151) ([aldesantis](https://github.com/aldesantis))
43
- - Move generated factories to `testing\_support/` [\#150](https://github.com/solidusio/solidus_dev_support/pull/150) ([aldesantis](https://github.com/aldesantis))
94
+ - Move generated factories to `testing_support/` [\#150](https://github.com/solidusio/solidus_dev_support/pull/150) ([aldesantis](https://github.com/aldesantis))
44
95
  - Add extension configuration boilerplate [\#149](https://github.com/solidusio/solidus_dev_support/pull/149) ([aldesantis](https://github.com/aldesantis))
45
96
 
46
97
  **Fixed bugs:**
@@ -16,7 +16,6 @@ require 'factory_bot'
16
16
  require 'ffaker'
17
17
 
18
18
  require 'spree/testing_support/authorization_helpers'
19
- require 'spree/testing_support/factories'
20
19
  require 'spree/testing_support/url_helpers'
21
20
  require 'spree/testing_support/preferences'
22
21
  require 'spree/testing_support/controller_requests'
@@ -42,10 +42,17 @@ bundle exec rubocop
42
42
  ```
43
43
 
44
44
  When testing your application's integration with this extension you may use its factories.
45
- Simply add this require statement to your spec_helper:
45
+ Simply add this require statement to your `spec/spec_helper.rb`:
46
46
 
47
47
  ```ruby
48
- require '<%= file_name %>/factories'
48
+ require '<%= file_name %>/testing_support/factories'
49
+ ```
50
+
51
+ Or, if you are using `FactoryBot.definition_file_paths`, you can load Solidus core
52
+ factories along with this extension's factories using this statement:
53
+
54
+ ```ruby
55
+ SolidusDevSupport::TestingSupport::Factories.load_for(<%= class_name %>::Engine)
49
56
  ```
50
57
 
51
58
  ### Running the sandbox
@@ -67,7 +67,7 @@ unbundled bundle install --gemfile Gemfile
67
67
 
68
68
  unbundled bundle exec rake db:drop db:create
69
69
 
70
- unbundled bundle exec rails generate spree:install \
70
+ unbundled bundle exec rails generate solidus:install \
71
71
  --auto-accept \
72
72
  --user_class=Spree::User \
73
73
  --enforce_available_locales=true \
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
31
 
32
- spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 3']
32
+ spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 4']
33
33
  spec.add_dependency 'solidus_support', '~> 0.5'
34
34
 
35
35
  spec.add_development_dependency 'solidus_dev_support', '<%= SolidusDevSupport.gem_version.approximate_recommendation %>'
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'solidus_core'
4
- require 'solidus_support'
5
-
6
3
  require '<%=file_name%>/configuration'
7
4
  require '<%=file_name%>/version'
8
5
  require '<%=file_name%>/engine'
@@ -2,7 +2,7 @@
2
2
 
3
3
  module <%= class_name %>
4
4
  class Configuration
5
- # Define here the settings for this extensions, e.g.:
5
+ # Define here the settings for this extension, e.g.:
6
6
  #
7
7
  # attr_accessor :my_setting
8
8
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/core'
4
- require '<%= file_name %>'
3
+ require 'solidus_core'
4
+ require 'solidus_support'
5
5
 
6
6
  module <%= class_name %>
7
7
  class Engine < Rails::Engine
@@ -1,20 +1,75 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/testing_support/factories'
4
3
  require 'factory_bot'
5
4
 
5
+ Spree::Deprecation.silence do
6
+ require 'spree/testing_support/factories'
7
+ puts <<~MSG
8
+ We are transitioning to a new way of loading factories for extensions.
9
+ Be sure this extension does not load factories using require but uses
10
+ the load_for() method in its spec_helper.rb, eg:
11
+
12
+ SolidusDevSupport::TestingSupport::Factories.load_for(ExtensionName1::Engine, ExtensionName2::Engine)
13
+
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
+
18
+ This message will be removed when all extensions are updated.
19
+ MSG
20
+ end
21
+
22
+ begin
23
+ require 'spree/testing_support/factory_bot'
24
+ rescue LoadError
25
+ # Do nothing, we are testing the extension against an old version of Solidus
26
+ end
27
+
6
28
  module SolidusDevSupport
7
29
  module TestingSupport
8
30
  module Factories
9
31
  def self.load_for(*engines)
10
32
  paths = engines.flat_map do |engine|
11
- engine.root.glob('lib/**/factories.rb')
12
- end
33
+ # Check if the extension has a lib/*/factories.rb. If it does, we emit a
34
+ # deprecation warning and just use it.
35
+ obsolete_factories_file = engine.root.glob('lib/*/factories.rb').first # 'lib/*/factories/*_factory.rb'
36
+ if obsolete_factories_file.present?
37
+ ActiveSupport::Deprecation.warn <<-WARN.squish, caller(4)
38
+ SolidusDevSupport::TestingSupport::Factories.load_for() is automatically loading
39
+ all factories present in #{obsolete_factories_file.dirname.to_s.gsub(engine.root.to_s, '')}/testing_support/factories/.
40
+ Please move the content of #{obsolete_factories_file.to_s.gsub(engine.root.to_s, '')} to that directory.
41
+ WARN
42
+
43
+ [obsolete_factories_file]
44
+ else
45
+ # If there are both a lib/*/testing_support/factories.rb and a lib/*/testing_support/factories/,
46
+ # we assume that the factories.rb file is only used to load all factories prensent in the directory.
47
+ # That file can be removed from the extension, in fact, we ignore it and emit a message asking to
48
+ # remove it.
49
+ factories_file_or_folder = engine.root.glob('lib/*/testing_support/factories{,.rb}')
50
+ if factories_file_or_folder.size == 2
51
+ folder, file = factories_file_or_folder.partition(&:directory?).map(&:first).map { |path| path.to_s.gsub(engine.root.to_s, '') }
52
+ ActiveSupport::Deprecation.warn <<-WARN.squish, caller(4)
53
+ SolidusDevSupport::TestingSupport::Factories.load_for() is automatically loading
54
+ all factories present into #{folder}. You should now safely remove #{file} if it
55
+ is only used to load ./factories content.
56
+ WARN
57
+
58
+ engine.root.glob('lib/*/testing_support/factories/**/*_factory.rb')
59
+ elsif factories_file_or_folder.first.directory?
60
+ engine.root.glob('lib/*/testing_support/factories/**/*_factory.rb')
61
+ else
62
+ factories_file_or_folder
63
+ end
64
+ end
65
+ end.map { |path| path.sub(/.rb\z/, '').to_s }
66
+
67
+ if using_factory_bot_definition_file_paths?
68
+ FactoryBot.definition_file_paths = [
69
+ Spree::TestingSupport::FactoryBot.definition_file_paths,
70
+ paths,
71
+ ].flatten
13
72
 
14
- if Spree::TestingSupport.respond_to? :load_all_factories
15
- FactoryBot.definition_file_paths.concat(
16
- paths.map { |path| path.sub(/.rb\z/, '').to_s }
17
- )
18
73
  FactoryBot.reload
19
74
  else
20
75
  FactoryBot.find_definitions
@@ -22,6 +77,11 @@ module SolidusDevSupport
22
77
  paths.each { |path| require path }
23
78
  end
24
79
  end
80
+
81
+ def self.using_factory_bot_definition_file_paths?
82
+ defined?(Spree::TestingSupport::FactoryBot) &&
83
+ Spree::TestingSupport::FactoryBot.respond_to?(:definition_file_paths)
84
+ end
25
85
  end
26
86
  end
27
87
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusDevSupport
4
- VERSION = "2.3.0"
4
+ VERSION = "2.5.0"
5
5
 
6
6
  def self.gem_version
7
7
  Gem::Version.new(VERSION)
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.metadata['source_code_uri'] = 'https://github.com/solidusio/solidus_dev_support'
17
17
  spec.metadata['changelog_uri'] = 'https://github.com/solidusio/solidus_dev_support/blob/master/CHANGELOG.md'
18
18
 
19
- spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
19
+ spec.required_ruby_version = '>= 2.5.0'
20
20
 
21
21
  # Specify which files should be added to the gem when it is released.
22
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -44,7 +44,7 @@ Gem::Specification.new do |spec|
44
44
  spec.add_dependency 'rubocop-performance', '~> 1.5'
45
45
  spec.add_dependency 'rubocop-rails', '~> 2.3'
46
46
  spec.add_dependency 'rubocop-rspec', '~> 2.0'
47
- spec.add_dependency 'solidus_core', ['>= 2.0', '< 3']
47
+ spec.add_dependency 'solidus_core', ['>= 2.0', '< 4']
48
48
  spec.add_dependency 'webdrivers', '~> 4.4'
49
49
 
50
50
  spec.add_development_dependency 'bundler'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_dev_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Desantis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-14 00:00:00.000000000 Z
11
+ date: 2021-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -243,7 +243,7 @@ dependencies:
243
243
  version: '2.0'
244
244
  - - "<"
245
245
  - !ruby/object:Gem::Version
246
- version: '3'
246
+ version: '4'
247
247
  type: :runtime
248
248
  prerelease: false
249
249
  version_requirements: !ruby/object:Gem::Requirement
@@ -253,7 +253,7 @@ dependencies:
253
253
  version: '2.0'
254
254
  - - "<"
255
255
  - !ruby/object:Gem::Version
256
- version: '3'
256
+ version: '4'
257
257
  - !ruby/object:Gem::Dependency
258
258
  name: webdrivers
259
259
  requirement: !ruby/object:Gem::Requirement
@@ -390,9 +390,9 @@ require_paths:
390
390
  - lib
391
391
  required_ruby_version: !ruby/object:Gem::Requirement
392
392
  requirements:
393
- - - "~>"
393
+ - - ">="
394
394
  - !ruby/object:Gem::Version
395
- version: '2.5'
395
+ version: 2.5.0
396
396
  required_rubygems_version: !ruby/object:Gem::Requirement
397
397
  requirements:
398
398
  - - ">="