factory_bot_instrumentation 1.1.3 → 1.1.5

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: b248a577b9cec82d72bbb47413e999e6aeb9d5c8abb2c5ebd859748335acaa43
4
- data.tar.gz: f0fa32df2602e74ff666c9a8eedb2378d07a469844df0eed7ebb82f5e363bb9b
3
+ metadata.gz: 5e200ee9b6c940652aa1655e8be54bc38815e8ed59678315984320d34292e7c6
4
+ data.tar.gz: 0a74dd73fecc873a368010fdb6e445dda7d3be012452553bc552de1968140965
5
5
  SHA512:
6
- metadata.gz: 1de14c66d5da657cd5035545341548816b25b76a26f926cbd488f51d5ade26c0d031d5495ea2bcfb07ac1b71c8387050e4a23be2278196a69af5cea7ea406d8f
7
- data.tar.gz: 9b1cd170bdfda25d8cade7a06fe535f5db3584663de14b4c59c9dec162d3f8452931e55c0115975102ac2fc2ac7d71d98c5d82623a187ed455f3f59b57260724
6
+ metadata.gz: c79689fbe92b67f676532e0876b88352011193220409019dc630efdc75b6da971809a7d15333c8b6789f627e5b0239964ae0834c0f6748a71ae7860469f8b94b
7
+ data.tar.gz: d2bdbbf8c0e74e6335fa68a9b58f62dc48685e8a835bbcaaaca117e80cbfd89e61f48656030802afffd9ce202ee41f83ac9c245fbc2ddccf60cb0081c905f3e6
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  * TODO: Replace this bullet point with an actual description of a change.
4
4
 
5
+ ### 1.1.5
6
+
7
+ * Added fallbacks for configuration processing (#19)
8
+
9
+ ### 1.1.4
10
+
11
+ * Pinned factory_bot down to < 6.4.5 in order to support Ruby 2.5 (#18)
12
+ * Added handling to support Psych 4 and 5 (#18)
13
+
5
14
  ### 1.1.3
6
15
 
7
16
  * Corrected the fallback view path configuration (#17)
data/Makefile CHANGED
@@ -29,6 +29,7 @@ ID ?= id
29
29
  MKDIR ?= mkdir
30
30
  RM ?= rm
31
31
  SORT ?= sort
32
+ TEST ?= test
32
33
  XARGS ?= xargs
33
34
 
34
35
  # Container binaries
@@ -39,6 +40,7 @@ RAKE ?= rake
39
40
  RSPEC ?= rspec
40
41
  RUBOCOP ?= rubocop
41
42
  YARD ?= yard
43
+ RUBY_VERSION := ruby-version
42
44
 
43
45
  # Files
44
46
  GEMFILES ?= $(subst _,-,$(patsubst $(GEMFILES_DIR)/%.gemfile,%,\
@@ -117,7 +119,8 @@ test-style: \
117
119
 
118
120
  test-style-ruby:
119
121
  # Run the static code analyzer (rubocop)
120
- @$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a)
122
+ @$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a \
123
+ || ($(TEST) $$($(RUBY_VERSION)) != '2.5' && true))
121
124
 
122
125
  clean:
123
126
  # Clean the dependencies
@@ -85,22 +85,19 @@ module FactoryBot
85
85
  # to get always a fresh state.
86
86
  #
87
87
  # @return [Hash{String => Mixed}] the instrumentation scenarios
88
- #
89
- # rubocop:disable Security/YAMLLoad because we just load
90
- # local configuration files here
91
88
  def instrumentation
92
89
  config_file = FactoryBot::Instrumentation.configuration.config_file.to_s
93
- content = Pathname.new(config_file).read
94
- template = ERB.new(content)
95
- YAML.load(template.result(binding))[Rails.env]
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] || {}
96
93
  end
97
- # rubocop:enable Security/YAMLLoad
98
94
 
99
95
  # Map all the instrumentation scenarios into groups and pass them back.
100
96
  #
101
97
  # @return [Hash{String => Array}] the grouped scenarios
102
98
  def scenarios
103
- instrumentation['scenarios'].each_with_object({}) do |scenario, memo|
99
+ res = (instrumentation['scenarios'] || [])
100
+ res.each_with_object({}) do |scenario, memo|
104
101
  group = scenario_group(scenario['name'])
105
102
  scenario['group'] = group
106
103
  memo[group] = [] unless memo.key? group
@@ -112,7 +109,7 @@ module FactoryBot
112
109
  #
113
110
  # @return [Hash{Regexp => String}] the group mapping
114
111
  def groups
115
- instrumentation['groups'].transform_keys do |key|
112
+ (instrumentation['groups'] || {}).transform_keys do |key|
116
113
  Regexp.new(Regexp.quote(key))
117
114
  end
118
115
  end
@@ -33,7 +33,9 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.required_ruby_version = '>= 2.5'
35
35
 
36
- spec.add_runtime_dependency 'factory_bot', '~> 6.2'
36
+ # TODO: Remove the upper lock when
37
+ # https://github.com/thoughtbot/factory_bot/issues/1614 is solved.
38
+ spec.add_runtime_dependency 'factory_bot', '~> 6.2', '< 6.4.5'
37
39
  spec.add_runtime_dependency 'rails', '>= 5.2'
38
40
  spec.add_runtime_dependency 'retries', '>= 0.0.5'
39
41
  end
@@ -4,7 +4,7 @@ module FactoryBot
4
4
  # The gem version details.
5
5
  module Instrumentation
6
6
  # The version of the +factory_bot_instrumentation+ gem
7
- VERSION = '1.1.3'
7
+ VERSION = '1.1.5'
8
8
 
9
9
  class << self
10
10
  # Returns the version of gem as a string.
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.1.3
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hermann Mayer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-18 00:00:00.000000000 Z
11
+ date: 2024-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: factory_bot
@@ -17,6 +17,9 @@ 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
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
29
  version: '6.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 6.4.5
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rails
29
35
  requirement: !ruby/object:Gem::Requirement