solidus_dev_support 2.2.0 → 2.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +46 -10
- data/Gemfile +0 -1
- data/lib/solidus_dev_support/rake_tasks.rb +10 -0
- data/lib/solidus_dev_support/rspec/rails_helper.rb +1 -3
- data/lib/solidus_dev_support/templates/extension/README.md +9 -2
- data/lib/solidus_dev_support/templates/extension/bin/sandbox.tt +1 -1
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%.rb.tt +0 -3
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%/configuration.rb.tt +1 -1
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%/engine.rb.tt +2 -2
- data/lib/solidus_dev_support/templates/extension/spec/spec_helper.rb.tt +1 -1
- data/lib/solidus_dev_support/testing_support/factories.rb +87 -0
- data/lib/solidus_dev_support/version.rb +1 -1
- data/solidus_dev_support.gemspec +3 -2
- data/spec/features/create_extension_spec.rb +5 -0
- metadata +22 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c114329424b9f471d8ac9c41c3d757a788b32b3bcdf57b383f9f6400a6a66881
|
4
|
+
data.tar.gz: 99668378fb9a6124a2f3b21df7311179466411b58de431814e15af78bcac2690
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffb1dd05af39f72148c299ac03616837a215e7b4754871f2bfc078e9a14e458dd89e351c5ad29450e61f068cc5baca6c614b8d2caeee4e46b30ccc9758616d7d
|
7
|
+
data.tar.gz: a7d4466e3fbec9e9d6a18f9a6cfc6bd28da198aaeb7cdce2104cd0c4c0349b78abf1b2165ef9aef8ad9a1d746ad9caaa49bd2737888ff049e160029e4fcac946
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,38 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [
|
3
|
+
## [v2.4.0](https://github.com/solidusio/solidus_dev_support/tree/v2.4.0) (2021-02-05)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.
|
5
|
+
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.3.0...v2.4.0)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Improve engine's requires to remove double inclusions [\#165](https://github.com/solidusio/solidus_dev_support/pull/165) ([kennyadsl](https://github.com/kennyadsl))
|
10
|
+
- Remove double require of core factories from rails\_helper [\#164](https://github.com/solidusio/solidus_dev_support/pull/164) ([kennyadsl](https://github.com/kennyadsl))
|
11
|
+
|
12
|
+
**Fixed bugs:**
|
13
|
+
|
14
|
+
- Fix typo in configuration.rb.tt [\#166](https://github.com/solidusio/solidus_dev_support/pull/166) ([brchristian](https://github.com/brchristian))
|
15
|
+
|
16
|
+
**Merged pull requests:**
|
17
|
+
|
18
|
+
- 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))
|
19
|
+
|
20
|
+
## [v2.3.0](https://github.com/solidusio/solidus_dev_support/tree/v2.3.0) (2021-01-14)
|
21
|
+
|
22
|
+
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.2.0...v2.3.0)
|
23
|
+
|
24
|
+
**Implemented enhancements:**
|
25
|
+
|
26
|
+
- Do not raise if source\_code\_uri is missing in the gemspec [\#163](https://github.com/solidusio/solidus_dev_support/pull/163) ([kennyadsl](https://github.com/kennyadsl))
|
27
|
+
- Factory bot fixes for latest Solidus 2.11 release [\#162](https://github.com/solidusio/solidus_dev_support/pull/162) ([elia](https://github.com/elia))
|
28
|
+
|
29
|
+
**Fixed bugs:**
|
30
|
+
|
31
|
+
- use rubocop-rspec 2.x [\#161](https://github.com/solidusio/solidus_dev_support/pull/161) ([ccarruitero](https://github.com/ccarruitero))
|
32
|
+
|
33
|
+
## [v2.2.0](https://github.com/solidusio/solidus_dev_support/tree/v2.2.0) (2020-11-27)
|
34
|
+
|
35
|
+
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v2.1.0...v2.2.0)
|
6
36
|
|
7
37
|
**Implemented enhancements:**
|
8
38
|
|
@@ -44,7 +74,7 @@
|
|
44
74
|
|
45
75
|
## [v2.0.0](https://github.com/solidusio/solidus_dev_support/tree/v2.0.0) (2020-09-22)
|
46
76
|
|
47
|
-
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v1.
|
77
|
+
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v1.6.0...v2.0.0)
|
48
78
|
|
49
79
|
**Breaking changes:**
|
50
80
|
|
@@ -55,6 +85,19 @@
|
|
55
85
|
- Enable new RuboCop cops automatically [\#143](https://github.com/solidusio/solidus_dev_support/pull/143) ([aldesantis](https://github.com/aldesantis))
|
56
86
|
- Don't forcefully close issues via stale-bot [\#139](https://github.com/solidusio/solidus_dev_support/pull/139) ([elia](https://github.com/elia))
|
57
87
|
- Add the approximate recommendation for dev-support to the gemspec [\#137](https://github.com/solidusio/solidus_dev_support/pull/137) ([elia](https://github.com/elia))
|
88
|
+
|
89
|
+
**Fixed bugs:**
|
90
|
+
|
91
|
+
- fix capybara driver declaration [\#141](https://github.com/solidusio/solidus_dev_support/pull/141) ([ccarruitero](https://github.com/ccarruitero))
|
92
|
+
- Bump RuboCop to latest 0.90.0 version [\#138](https://github.com/solidusio/solidus_dev_support/pull/138) ([peterberkenbosch](https://github.com/peterberkenbosch))
|
93
|
+
- Fix missing backslash in solidus install command [\#135](https://github.com/solidusio/solidus_dev_support/pull/135) ([nirebu](https://github.com/nirebu))
|
94
|
+
|
95
|
+
## [v1.6.0](https://github.com/solidusio/solidus_dev_support/tree/v1.6.0) (2020-08-26)
|
96
|
+
|
97
|
+
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v1.5.0...v1.6.0)
|
98
|
+
|
99
|
+
**Implemented enhancements:**
|
100
|
+
|
58
101
|
- Let the extension name include spaces [\#133](https://github.com/solidusio/solidus_dev_support/pull/133) ([elia](https://github.com/elia))
|
59
102
|
- Add precompiled badges fro CI and coverage [\#132](https://github.com/solidusio/solidus_dev_support/pull/132) ([elia](https://github.com/elia))
|
60
103
|
- Add Changelog Rake task [\#128](https://github.com/solidusio/solidus_dev_support/pull/128) ([tvdeyen](https://github.com/tvdeyen))
|
@@ -62,16 +105,9 @@
|
|
62
105
|
|
63
106
|
**Fixed bugs:**
|
64
107
|
|
65
|
-
- fix capybara driver declaration [\#141](https://github.com/solidusio/solidus_dev_support/pull/141) ([ccarruitero](https://github.com/ccarruitero))
|
66
|
-
- Bump RuboCop to latest 0.90.0 version [\#138](https://github.com/solidusio/solidus_dev_support/pull/138) ([peterberkenbosch](https://github.com/peterberkenbosch))
|
67
|
-
- Fix missing backslash in solidus install command [\#135](https://github.com/solidusio/solidus_dev_support/pull/135) ([nirebu](https://github.com/nirebu))
|
68
108
|
- Don't install a payment-method in the sandbox [\#131](https://github.com/solidusio/solidus_dev_support/pull/131) ([elia](https://github.com/elia))
|
69
109
|
- Run extension generator in sandbox [\#127](https://github.com/solidusio/solidus_dev_support/pull/127) ([elia](https://github.com/elia))
|
70
110
|
|
71
|
-
**Merged pull requests:**
|
72
|
-
|
73
|
-
- Update readme template [\#109](https://github.com/solidusio/solidus_dev_support/pull/109) ([aldesantis](https://github.com/aldesantis))
|
74
|
-
|
75
111
|
## [v1.5.0](https://github.com/solidusio/solidus_dev_support/tree/v1.5.0) (2020-06-13)
|
76
112
|
|
77
113
|
[Full Changelog](https://github.com/solidusio/solidus_dev_support/compare/v1.4.0...v1.5.0)
|
data/Gemfile
CHANGED
@@ -83,6 +83,16 @@ module SolidusDevSupport
|
|
83
83
|
config.user = repo.owner
|
84
84
|
config.project = repo.name
|
85
85
|
config.future_release = "v#{ENV['UNRELEASED_VERSION'] || gemspec.version}"
|
86
|
+
|
87
|
+
rescue Octokit::InvalidRepository
|
88
|
+
warn <<~WARN
|
89
|
+
It won't be possible to automatically generate the CHANGELOG for this extension because the
|
90
|
+
gemspec is missing the `source_code_uri` metadata. Please add this line to the gemspec to
|
91
|
+
enable automatic CHANGELOG generation:
|
92
|
+
|
93
|
+
s.metadata["source_code_uri"] = 'https://github.com/org/repo'
|
94
|
+
|
95
|
+
WARN
|
86
96
|
end
|
87
97
|
end
|
88
98
|
end
|
@@ -16,14 +16,12 @@ 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'
|
22
|
+
require 'solidus_dev_support/testing_support/factories'
|
23
23
|
require 'solidus_dev_support/testing_support/preferences'
|
24
24
|
|
25
|
-
FactoryBot.find_definitions
|
26
|
-
|
27
25
|
RSpec.configure do |config|
|
28
26
|
config.infer_spec_type_from_file_location!
|
29
27
|
|
@@ -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
|
70
|
+
unbundled bundle exec rails generate solidus:install \
|
71
71
|
--auto-accept \
|
72
72
|
--user_class=Spree::User \
|
73
73
|
--enforce_available_locales=true \
|
@@ -19,7 +19,7 @@ require 'solidus_dev_support/rspec/feature_helper'
|
|
19
19
|
Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f }
|
20
20
|
|
21
21
|
# Requires factories defined in lib/<%= file_name %>/testing_support/factories.rb
|
22
|
-
|
22
|
+
SolidusDevSupport::TestingSupport::Factories.load_for(<%= class_name %>::Engine)
|
23
23
|
|
24
24
|
RSpec.configure do |config|
|
25
25
|
config.infer_spec_type_from_file_location!
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'factory_bot'
|
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
|
+
|
28
|
+
module SolidusDevSupport
|
29
|
+
module TestingSupport
|
30
|
+
module Factories
|
31
|
+
def self.load_for(*engines)
|
32
|
+
paths = engines.flat_map do |engine|
|
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
|
72
|
+
|
73
|
+
FactoryBot.reload
|
74
|
+
else
|
75
|
+
FactoryBot.find_definitions
|
76
|
+
|
77
|
+
paths.each { |path| require path }
|
78
|
+
end
|
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
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
data/solidus_dev_support.gemspec
CHANGED
@@ -32,7 +32,8 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_dependency 'capybara-screenshot', '~> 1.0'
|
33
33
|
spec.add_dependency 'codecov', '~> 0.2'
|
34
34
|
spec.add_dependency 'database_cleaner', '~> 1.7'
|
35
|
-
spec.add_dependency '
|
35
|
+
spec.add_dependency 'factory_bot', '~> 4.8'
|
36
|
+
spec.add_dependency 'factory_bot_rails'
|
36
37
|
spec.add_dependency 'ffaker', '~> 2.13'
|
37
38
|
spec.add_dependency 'gem-release', '~> 2.1'
|
38
39
|
spec.add_dependency 'github_changelog_generator', '~> 1.15'
|
@@ -42,7 +43,7 @@ Gem::Specification.new do |spec|
|
|
42
43
|
spec.add_dependency 'rubocop', '~> 1.0'
|
43
44
|
spec.add_dependency 'rubocop-performance', '~> 1.5'
|
44
45
|
spec.add_dependency 'rubocop-rails', '~> 2.3'
|
45
|
-
spec.add_dependency 'rubocop-rspec', '~>
|
46
|
+
spec.add_dependency 'rubocop-rspec', '~> 2.0'
|
46
47
|
spec.add_dependency 'solidus_core', ['>= 2.0', '< 3']
|
47
48
|
spec.add_dependency 'webdrivers', '~> 4.4'
|
48
49
|
|
@@ -122,11 +122,16 @@ RSpec.describe 'Create extension' do
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def check_run_specs
|
125
|
+
install_path.join('lib', 'solidus_test_extension', 'testing_support', 'factories.rb').open('a') do |factories_file|
|
126
|
+
factories_file.write "\n puts 'loading test_extension factories'"
|
127
|
+
end
|
128
|
+
|
125
129
|
install_path.join('spec', 'some_spec.rb').write(
|
126
130
|
"require 'spec_helper'\nRSpec.describe 'Some test' do it { expect(true).to be_truthy } end\n"
|
127
131
|
)
|
128
132
|
cd(install_path) do
|
129
133
|
output = sh('bundle exec rspec')
|
134
|
+
expect(output).to include('loading test_extension factories')
|
130
135
|
expect(output).to include('1 example, 0 failures')
|
131
136
|
expect(output).to include(ENV['CODECOV_TOKEN'] ? 'Coverage reports upload successfully' : 'Provide a CODECOV_TOKEN environment variable to enable Codecov uploads')
|
132
137
|
end
|
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.
|
4
|
+
version: 2.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Desantis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -67,19 +67,33 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.7'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: factory_bot
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '4.8'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '4.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: factory_bot_rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: ffaker
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,14 +226,14 @@ dependencies:
|
|
212
226
|
requirements:
|
213
227
|
- - "~>"
|
214
228
|
- !ruby/object:Gem::Version
|
215
|
-
version: '
|
229
|
+
version: '2.0'
|
216
230
|
type: :runtime
|
217
231
|
prerelease: false
|
218
232
|
version_requirements: !ruby/object:Gem::Requirement
|
219
233
|
requirements:
|
220
234
|
- - "~>"
|
221
235
|
- !ruby/object:Gem::Version
|
222
|
-
version: '
|
236
|
+
version: '2.0'
|
223
237
|
- !ruby/object:Gem::Dependency
|
224
238
|
name: solidus_core
|
225
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -356,6 +370,7 @@ files:
|
|
356
370
|
- lib/solidus_dev_support/templates/extension/rspec
|
357
371
|
- lib/solidus_dev_support/templates/extension/rubocop.yml
|
358
372
|
- lib/solidus_dev_support/templates/extension/spec/spec_helper.rb.tt
|
373
|
+
- lib/solidus_dev_support/testing_support/factories.rb
|
359
374
|
- lib/solidus_dev_support/testing_support/preferences.rb
|
360
375
|
- lib/solidus_dev_support/version.rb
|
361
376
|
- solidus_dev_support.gemspec
|