factory_bot_instrumentation 1.2.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +2 -2
- data/.rubocop.yml +1 -1
- data/.yardopts +1 -0
- data/Appraisals +0 -4
- data/CHANGELOG.md +34 -24
- data/Gemfile +1 -1
- data/app/controllers/factory_bot/instrumentation/application_controller.rb +47 -0
- data/app/controllers/factory_bot/instrumentation/root_controller.rb +0 -47
- data/factory_bot_instrumentation.gemspec +3 -5
- data/gemfiles/rails_6.1.gemfile +1 -1
- data/gemfiles/rails_7.1.gemfile +1 -1
- data/lib/factory_bot/instrumentation/version.rb +1 -1
- metadata +4 -11
- data/gemfiles/rails_5.2.gemfile +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37442055c37286bda9ecc80137609a66e4170181350f1fe494e0140cf888a33c
|
4
|
+
data.tar.gz: eb684ed40aad5659818346b43b22510c981fac3283ce81239ff943b3148aa72b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c24c700505db37bd0960ccf4d4f941c9117c2b0885b15fbabe871ee7b63bd5d87b259e77a94e751784f9c51edb4d08c04f22ea6338ca4d0cf913475245d6f165
|
7
|
+
data.tar.gz: 20461fb181cd6e48fd3c7a32d5cfbc1f0647fb5a85095564c4cdeff3951a23b8a6047d6b60a532588f763222bb8475bac5ee8f0e27dd06d9fa6a20e40f3a07d4
|
data/.github/workflows/test.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.yardopts
CHANGED
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,65 +2,75 @@
|
|
2
2
|
|
3
3
|
* TODO: Replace this bullet point with an actual description of a change.
|
4
4
|
|
5
|
-
### 1.
|
5
|
+
### 1.4.0 (6 January 2025)
|
6
|
+
|
7
|
+
* Moved the instrumentation methods (`#instrumentation`, `#scenarios`,
|
8
|
+
`#groups`, `#scenario_group`) from the `RootController` to the
|
9
|
+
`ApplicationController` (#23)
|
10
|
+
|
11
|
+
### 1.3.0 (3 January 2025)
|
12
|
+
|
13
|
+
* Raised minimum supported Ruby/Rails version to 2.7/6.1 (#22)
|
14
|
+
|
15
|
+
### 1.2.4 (15 August 2024)
|
6
16
|
|
7
17
|
* Just a retag of 1.2.1
|
8
18
|
|
9
|
-
### 1.2.3
|
19
|
+
### 1.2.3 (15 August 2024)
|
10
20
|
|
11
21
|
* Just a retag of 1.2.1
|
12
22
|
|
13
|
-
### 1.2.2
|
23
|
+
### 1.2.2 (9 August 2024)
|
14
24
|
|
15
25
|
* Just a retag of 1.2.1
|
16
26
|
|
17
|
-
### 1.2.1
|
27
|
+
### 1.2.1 (9 August 2024)
|
18
28
|
|
19
29
|
* Added API docs building to continuous integration (#21)
|
20
30
|
|
21
|
-
### 1.2.0
|
31
|
+
### 1.2.0 (8 July 2024)
|
22
32
|
|
23
33
|
* Dropped support for Ruby <2.7 (#20)
|
24
34
|
|
25
|
-
### 1.1.5
|
35
|
+
### 1.1.5 (18 February 2024)
|
26
36
|
|
27
37
|
* Added fallbacks for configuration processing (#19)
|
28
38
|
|
29
|
-
### 1.1.4
|
39
|
+
### 1.1.4 (5 January 2024)
|
30
40
|
|
31
41
|
* Pinned factory_bot down to < 6.4.5 in order to support Ruby 2.5 (#18)
|
32
42
|
* Added handling to support Psych 4 and 5 (#18)
|
33
43
|
|
34
|
-
### 1.1.3
|
44
|
+
### 1.1.3 (18 December 2023)
|
35
45
|
|
36
46
|
* Corrected the fallback view path configuration (#17)
|
37
47
|
|
38
|
-
### 1.1.2
|
48
|
+
### 1.1.2 (18 December 2023)
|
39
49
|
|
40
50
|
* Moved the development dependencies from the gemspec to the Gemfile (#15)
|
41
51
|
* Added a fallback view path handling in case an Rails application cannot
|
42
52
|
find our engine templates correctly (#16)
|
43
53
|
|
44
|
-
### 1.1.1
|
54
|
+
### 1.1.1 (24 February 2023)
|
45
55
|
|
46
56
|
* Removed double bundler/gem_tasks handling
|
47
57
|
|
48
|
-
### 1.1.0
|
58
|
+
### 1.1.0 (24 February 2023)
|
49
59
|
|
50
60
|
* Added support for Gem release automation
|
51
61
|
|
52
|
-
### 1.0.2
|
62
|
+
### 1.0.2 (15 February 2023)
|
53
63
|
|
54
64
|
* When used in combination with the `factory_bot_rails` gem (>= 6.0) we do not
|
55
65
|
force a `FactoryBot.reload` at Rails engine initialization as it breaks with
|
56
66
|
an `FactoryBot::DuplicateDefinitionError` (#14)
|
57
67
|
|
58
|
-
### 1.0.1
|
68
|
+
### 1.0.1 (15 February 2023)
|
59
69
|
|
60
70
|
* Added a retry logic to the FactoryBot reloading on the POST/create endpoint
|
61
71
|
in order to handle parallel requests properly (#13)
|
62
72
|
|
63
|
-
### 1.0.0
|
73
|
+
### 1.0.0 (18 January 2023)
|
64
74
|
|
65
75
|
* Bundler >= 2.3 is from now on required as minimal version (#12)
|
66
76
|
* Dropped support for Ruby < 2.5 (#12)
|
@@ -68,49 +78,49 @@
|
|
68
78
|
* Updated all development/runtime gems to their latest
|
69
79
|
Ruby 2.5 compatible version (#12)
|
70
80
|
|
71
|
-
### 0.8.0
|
81
|
+
### 0.8.0 (10 December 2021)
|
72
82
|
|
73
83
|
* Added `FactoryBot.reload` to the initializer code to ensure the factories
|
74
84
|
are in place.
|
75
85
|
|
76
|
-
### 0.7.1
|
86
|
+
### 0.7.1 (15 October 2021)
|
77
87
|
|
78
88
|
* Migrated to Github Actions
|
79
89
|
* Migrated to our own coverage reporting
|
80
90
|
|
81
|
-
### 0.7.0
|
91
|
+
### 0.7.0 (15 October 2021)
|
82
92
|
|
83
93
|
* Dropped Rails 4 support
|
84
94
|
|
85
|
-
### 0.6.0
|
95
|
+
### 0.6.0 (21 September 2020)
|
86
96
|
|
87
97
|
* Added support for custom error handling and improved the default error
|
88
98
|
handling on FactoryBot usage (#9)
|
89
99
|
|
90
|
-
### 0.5.1
|
100
|
+
### 0.5.1 (12 May 2020)
|
91
101
|
|
92
102
|
* Corrected a bug on the scenario description update (#8)
|
93
103
|
|
94
|
-
### 0.5.0
|
104
|
+
### 0.5.0 (20 January 2020)
|
95
105
|
|
96
106
|
* Added support for custom before action logics (#7)
|
97
107
|
|
98
|
-
### 0.4.0
|
108
|
+
### 0.4.0 (9 December 2019)
|
99
109
|
|
100
110
|
* Added support for configurable rendering (#6)
|
101
111
|
|
102
|
-
### 0.3.0
|
112
|
+
### 0.3.0 (15 July 2019)
|
103
113
|
|
104
114
|
* Removed CI support for Ruby 2.3 (it never worked before)
|
105
115
|
* Fixed the overwrite params bug on Rails 4.2
|
106
116
|
* Added a test suite for the engine
|
107
117
|
|
108
|
-
### 0.2.0
|
118
|
+
### 0.2.0 (22 March 2019)
|
109
119
|
|
110
120
|
* Removed the Gemfile locks and added the to the ignore list
|
111
121
|
* Dropped Rails 3 support
|
112
122
|
* Added support for Bundler 1 and 2
|
113
123
|
|
114
|
-
### 0.1.0
|
124
|
+
### 0.1.0 (9 January 2019)
|
115
125
|
|
116
126
|
* Added the initial code base
|
data/Gemfile
CHANGED
@@ -13,7 +13,7 @@ gem 'bundler', '~> 2.3'
|
|
13
13
|
gem 'countless', '~> 1.1'
|
14
14
|
gem 'factory_bot_rails', '~> 6.2'
|
15
15
|
gem 'guard-rspec', '~> 4.7'
|
16
|
-
gem 'railties', '>=
|
16
|
+
gem 'railties', '>= 6.1'
|
17
17
|
gem 'rspec-rails', '~> 5.1'
|
18
18
|
gem 'rubocop', '~> 1.28'
|
19
19
|
gem 'rubocop-rails', '~> 2.14'
|
@@ -36,6 +36,53 @@ module FactoryBot
|
|
36
36
|
)
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
# Unfortunately +Rails.configuration.instrumentation+ is only read once
|
41
|
+
# and do not hot-reload on changes. Thats why we read this file manually
|
42
|
+
# to get always a fresh state.
|
43
|
+
#
|
44
|
+
# @return [Hash{String => Mixed}] the instrumentation scenarios
|
45
|
+
def instrumentation
|
46
|
+
config_file = FactoryBot::Instrumentation.configuration.config_file.to_s
|
47
|
+
template = ERB.new(Pathname.new(config_file).read)
|
48
|
+
load_method = YAML.respond_to?(:unsafe_load) ? :unsafe_load : :load
|
49
|
+
YAML.send(load_method, template.result(binding))[Rails.env] || {}
|
50
|
+
end
|
51
|
+
|
52
|
+
# Map all the instrumentation scenarios into groups and pass them back.
|
53
|
+
#
|
54
|
+
# @return [Hash{String => Array}] the grouped scenarios
|
55
|
+
def scenarios
|
56
|
+
res = instrumentation['scenarios'] || []
|
57
|
+
res.each_with_object({}) do |scenario, memo|
|
58
|
+
group = scenario_group(scenario['name'])
|
59
|
+
scenario['group'] = group
|
60
|
+
memo[group] = [] unless memo.key? group
|
61
|
+
memo[group] << scenario
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Map all the configured scenario groups to a useable hash.
|
66
|
+
#
|
67
|
+
# @return [Hash{Regexp => String}] the group mapping
|
68
|
+
def groups
|
69
|
+
(instrumentation['groups'] || {}).transform_keys do |key|
|
70
|
+
Regexp.new(Regexp.quote(key))
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Fetch the group name for a given scenario name. This will utilize the
|
75
|
+
# +SCENARIO_GROUPS+ map.
|
76
|
+
#
|
77
|
+
# @param name [String] the scenario name
|
78
|
+
# @return [String] the group name
|
79
|
+
def scenario_group(name)
|
80
|
+
groups.map do |pattern, group_name|
|
81
|
+
next unless pattern.match? name
|
82
|
+
|
83
|
+
group_name
|
84
|
+
end.compact.first || 'Various'
|
85
|
+
end
|
39
86
|
end
|
40
87
|
end
|
41
88
|
end
|
@@ -79,53 +79,6 @@ module FactoryBot
|
|
79
79
|
]
|
80
80
|
end
|
81
81
|
# rubocop:enable Metrics/MethodLength
|
82
|
-
|
83
|
-
# Unfortunately +Rails.configuration.instrumentation+ is only read once
|
84
|
-
# and do not hot-reload on changes. Thats why we read this file manually
|
85
|
-
# to get always a fresh state.
|
86
|
-
#
|
87
|
-
# @return [Hash{String => Mixed}] the instrumentation scenarios
|
88
|
-
def instrumentation
|
89
|
-
config_file = FactoryBot::Instrumentation.configuration.config_file.to_s
|
90
|
-
template = ERB.new(Pathname.new(config_file).read)
|
91
|
-
load_method = YAML.respond_to?(:unsafe_load) ? :unsafe_load : :load
|
92
|
-
YAML.send(load_method, template.result(binding))[Rails.env] || {}
|
93
|
-
end
|
94
|
-
|
95
|
-
# Map all the instrumentation scenarios into groups and pass them back.
|
96
|
-
#
|
97
|
-
# @return [Hash{String => Array}] the grouped scenarios
|
98
|
-
def scenarios
|
99
|
-
res = instrumentation['scenarios'] || []
|
100
|
-
res.each_with_object({}) do |scenario, memo|
|
101
|
-
group = scenario_group(scenario['name'])
|
102
|
-
scenario['group'] = group
|
103
|
-
memo[group] = [] unless memo.key? group
|
104
|
-
memo[group] << scenario
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
# Map all the configured scenario groups to a useable hash.
|
109
|
-
#
|
110
|
-
# @return [Hash{Regexp => String}] the group mapping
|
111
|
-
def groups
|
112
|
-
(instrumentation['groups'] || {}).transform_keys do |key|
|
113
|
-
Regexp.new(Regexp.quote(key))
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
# Fetch the group name for a given scenario name. This will utilize the
|
118
|
-
# +SCENARIO_GROUPS+ map.
|
119
|
-
#
|
120
|
-
# @param name [String] the scenario name
|
121
|
-
# @return [String] the group name
|
122
|
-
def scenario_group(name)
|
123
|
-
groups.map do |pattern, group_name|
|
124
|
-
next unless pattern.match? name
|
125
|
-
|
126
|
-
group_name
|
127
|
-
end.compact.first || 'Various'
|
128
|
-
end
|
129
82
|
end
|
130
83
|
end
|
131
84
|
end
|
@@ -33,9 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.required_ruby_version = '>= 2.7'
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
spec.
|
39
|
-
spec.add_runtime_dependency 'rails', '>= 5.2'
|
40
|
-
spec.add_runtime_dependency 'retries', '>= 0.0.5'
|
36
|
+
spec.add_dependency 'factory_bot', '~> 6.2'
|
37
|
+
spec.add_dependency 'rails', '>= 6.1'
|
38
|
+
spec.add_dependency 'retries', '>= 0.0.5'
|
41
39
|
end
|
data/gemfiles/rails_6.1.gemfile
CHANGED
@@ -7,7 +7,7 @@ gem "bundler", "~> 2.3"
|
|
7
7
|
gem "countless", "~> 1.1"
|
8
8
|
gem "factory_bot_rails", "~> 6.2"
|
9
9
|
gem "guard-rspec", "~> 4.7"
|
10
|
-
gem "railties", ">=
|
10
|
+
gem "railties", ">= 6.1"
|
11
11
|
gem "rspec-rails", "~> 5.1"
|
12
12
|
gem "rubocop", "~> 1.28"
|
13
13
|
gem "rubocop-rails", "~> 2.14"
|
data/gemfiles/rails_7.1.gemfile
CHANGED
@@ -7,7 +7,7 @@ gem "bundler", "~> 2.3"
|
|
7
7
|
gem "countless", "~> 1.1"
|
8
8
|
gem "factory_bot_rails", "~> 6.2"
|
9
9
|
gem "guard-rspec", "~> 4.7"
|
10
|
-
gem "railties", ">=
|
10
|
+
gem "railties", ">= 6.1"
|
11
11
|
gem "rspec-rails", "~> 5.1"
|
12
12
|
gem "rubocop", "~> 1.28"
|
13
13
|
gem "rubocop-rails", "~> 2.14"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_bot_instrumentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hermann Mayer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: factory_bot
|
@@ -17,9 +17,6 @@ dependencies:
|
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '6.2'
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 6.4.5
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,23 +24,20 @@ dependencies:
|
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '6.2'
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 6.4.5
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: rails
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
36
30
|
requirements:
|
37
31
|
- - ">="
|
38
32
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
33
|
+
version: '6.1'
|
40
34
|
type: :runtime
|
41
35
|
prerelease: false
|
42
36
|
version_requirements: !ruby/object:Gem::Requirement
|
43
37
|
requirements:
|
44
38
|
- - ">="
|
45
39
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
40
|
+
version: '6.1'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: retries
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,7 +110,6 @@ files:
|
|
116
110
|
- doc/assets/regular.png
|
117
111
|
- docker-compose.yml
|
118
112
|
- factory_bot_instrumentation.gemspec
|
119
|
-
- gemfiles/rails_5.2.gemfile
|
120
113
|
- gemfiles/rails_6.1.gemfile
|
121
114
|
- gemfiles/rails_7.1.gemfile
|
122
115
|
- lib/factory_bot/instrumentation/configuration.rb
|
data/gemfiles/rails_5.2.gemfile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "appraisal", "~> 2.4"
|
6
|
-
gem "bundler", "~> 2.3"
|
7
|
-
gem "countless", "~> 1.1"
|
8
|
-
gem "factory_bot_rails", "~> 6.2"
|
9
|
-
gem "guard-rspec", "~> 4.7"
|
10
|
-
gem "railties", ">= 5.2"
|
11
|
-
gem "rspec-rails", "~> 5.1"
|
12
|
-
gem "rubocop", "~> 1.28"
|
13
|
-
gem "rubocop-rails", "~> 2.14"
|
14
|
-
gem "rubocop-rspec", "~> 2.10"
|
15
|
-
gem "simplecov", ">= 0.22"
|
16
|
-
gem "sqlite3", "~> 1.5"
|
17
|
-
gem "timecop", ">= 0.9.6"
|
18
|
-
gem "yard", ">= 0.9.28"
|
19
|
-
gem "yard-activesupport-concern", ">= 0.0.1"
|
20
|
-
gem "rails", "~> 5.2.0"
|
21
|
-
|
22
|
-
gemspec path: "../"
|