eac_rails_gem_support 0.5.0 → 0.6.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: f7f28694f2816be105b4a9ad99a509894c0ef93cc44799f46a288b10dadff69f
4
- data.tar.gz: 2ae43a634dcc87ca9cbb9fb22fe4c7e0c00cfaa88f6202aa9acd51144e5ebd5b
3
+ metadata.gz: 2d285679a888e05aa97fb48708eb226ea50c113a99ad4e18b394be4f1c28bc41
4
+ data.tar.gz: 7a58f04b0049e2ce31abb0a9bd4d3cfb12ea9416197aae33cc9881a454eeb06e
5
5
  SHA512:
6
- metadata.gz: 4ca045ef2cb5f4101ee66ca0d48fde679812a0f06647c1b53bb5ab1e2b4a5b5ac30a55f07004e20c863f70e87ea08f985c680c363a381cb4105564748419ce4c
7
- data.tar.gz: 3c931401695a187fabfaa430eaf21f0e1cd0135afd5d35f04a1845bfaabec7e2d7faadd2525962f8a40ad5b1c1f4b74a34aa19b054a2eefaaa1f2019259b09bd
6
+ metadata.gz: 8800c2b55b5310b90116679ef19525309dbb7eeee653c647260d2ee921f99022d7c412d76f25fa7135951f981017b432ea8531608a7f00c12baedca69cbc5874
7
+ data.tar.gz: b4d526791901f0d834749aac2db43f391ffd6404a3ef72b37adebfae7d7e9a59a88274db6bb4ee6e82d5344c4058adca076f29ac5a43187a1ab39e7359e70744
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRailsGemSupport
6
+ module FactoryBot
7
+ class InstanceRegistry
8
+ class << self
9
+ def default
10
+ @default ||= ::EacRailsGemSupport::FactoryBot::InstanceRegistry.new
11
+ end
12
+
13
+ delegate :fetch, :reset, to: :default
14
+
15
+ def sanitize_key(key)
16
+ key.to_sym
17
+ end
18
+ end
19
+
20
+ def fetch(key)
21
+ key = self.class.sanitize_key(key)
22
+ if fetched.key?(key)
23
+ fetched.fetch(key)
24
+ else
25
+ fetched[key] = ::FactoryBot.create(key)
26
+ end
27
+ end
28
+
29
+ def reset
30
+ @fetched = nil
31
+ end
32
+
33
+ private
34
+
35
+ def fetched
36
+ @fetched ||= {}
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_rails_gem_support/patches/object/template'
4
3
  require 'avm/eac_ruby_base1/sources/base'
5
4
  require 'eac_ruby_utils/core_ext'
5
+ require 'eac_templates/core_ext'
6
6
  require 'fileutils'
7
7
 
8
8
  module EacRailsGemSupport
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
+ require 'eac_rails_gem_support/factory_bot/instance_registry'
4
5
 
5
6
  module EacRailsGemSupport
6
7
  module Rspec
@@ -10,6 +11,14 @@ module EacRailsGemSupport
10
11
  require 'factory_bot_rails'
11
12
  rspec_config.include ::FactoryBot::Syntax::Methods
12
13
  Spring.after_fork { ::FactoryBot.reload } if defined?(Spring)
14
+ rspec_config.include HelpMethods
15
+ rspec_config.after { ::EacRailsGemSupport::FactoryBot::InstanceRegistry.reset }
16
+ end
17
+
18
+ module HelpMethods
19
+ def factory_bot_fetch(key)
20
+ ::EacRailsGemSupport::FactoryBot::InstanceRegistry.fetch(key)
21
+ end
13
22
  end
14
23
  end
15
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRailsGemSupport
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_rails_gem_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-13 00:00:00.000000000 Z
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm-eac_ruby_base1
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.20'
19
+ version: '0.21'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.20'
26
+ version: '0.21'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: capybara
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -70,20 +70,14 @@ dependencies:
70
70
  requirements:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
- version: '0.102'
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: 0.102.1
73
+ version: '0.104'
77
74
  type: :runtime
78
75
  prerelease: false
79
76
  version_requirements: !ruby/object:Gem::Requirement
80
77
  requirements:
81
78
  - - "~>"
82
79
  - !ruby/object:Gem::Version
83
- version: '0.102'
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: 0.102.1
80
+ version: '0.104'
87
81
  - !ruby/object:Gem::Dependency
88
82
  name: eac_templates
89
83
  requirement: !ruby/object:Gem::Requirement
@@ -93,7 +87,7 @@ dependencies:
93
87
  version: '0.3'
94
88
  - - ">="
95
89
  - !ruby/object:Gem::Version
96
- version: 0.3.1
90
+ version: 0.3.2
97
91
  type: :runtime
98
92
  prerelease: false
99
93
  version_requirements: !ruby/object:Gem::Requirement
@@ -103,7 +97,7 @@ dependencies:
103
97
  version: '0.3'
104
98
  - - ">="
105
99
  - !ruby/object:Gem::Version
106
- version: 0.3.1
100
+ version: 0.3.2
107
101
  - !ruby/object:Gem::Dependency
108
102
  name: factory_bot_rails
109
103
  requirement: !ruby/object:Gem::Requirement
@@ -164,20 +158,14 @@ dependencies:
164
158
  requirements:
165
159
  - - "~>"
166
160
  - !ruby/object:Gem::Version
167
- version: '1.4'
168
- - - ">="
169
- - !ruby/object:Gem::Version
170
- version: 1.4.4
161
+ version: '1.5'
171
162
  type: :runtime
172
163
  prerelease: false
173
164
  version_requirements: !ruby/object:Gem::Requirement
174
165
  requirements:
175
166
  - - "~>"
176
167
  - !ruby/object:Gem::Version
177
- version: '1.4'
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: 1.4.4
168
+ version: '1.5'
181
169
  description:
182
170
  email:
183
171
  executables: []
@@ -185,8 +173,7 @@ extensions: []
185
173
  extra_rdoc_files: []
186
174
  files:
187
175
  - lib/eac_rails_gem_support.rb
188
- - lib/eac_rails_gem_support/patches/object.rb
189
- - lib/eac_rails_gem_support/patches/object/template.rb
176
+ - lib/eac_rails_gem_support/factory_bot/instance_registry.rb
190
177
  - lib/eac_rails_gem_support/rspec.rb
191
178
  - lib/eac_rails_gem_support/rspec/appendable_rails_app.rb
192
179
  - lib/eac_rails_gem_support/rspec/minitest_support.rb
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_templates/patches/object/template'
4
-
5
- ::EacTemplates::Searcher.default.included_paths <<
6
- ::File.expand_path('../../../../template', __dir__)
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- require_sub __FILE__