factory_bot_rails 5.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 396a0440b96b5f0ca9443ff3c8421b4408b5aaf7f4d79de72d41bbaaf53b17d2
4
- data.tar.gz: de1954538587c2c92359c12de3f2b0dbbfb2efcd29f9794500a6068d2d6309ab
3
+ metadata.gz: 51ea85a9365b7f82f29d2629ab19de461bf65870075542abdbc4cc1ce501f16b
4
+ data.tar.gz: 70eeaceae875965139eeaf4be38714f0ddf4e2221a9c446bf7a9b1efd098b37b
5
5
  SHA512:
6
- metadata.gz: f10916fc311d14c83d3856f8b00ba6cf884b8ea1609f76327af1c250793cad569a58b6ed245473aeeb20f400a1819dc9c4733cd5a2253c5d7ec8ffc65d574413
7
- data.tar.gz: 97b507d7053d5efc534e5fc2c8b2a95570f71a699f1b943d36ded6dc3c6b2e901b396cdcebc8ecef34c95ad37e2991d365c7c54baa50957a95bcb90ea3810b26
6
+ metadata.gz: d6a1dd1eaf56d3f0ef00c1b844d91433c3210f8d18bb0b978ee7e8c5de002817e6675256431ba8fa29164d504e374c40db65e82167907a51df984efc7b9e7b36
7
+ data.tar.gz: 41cdc0b7ff621c1955c1bbe426416ea2268068251b12532e05d3334dc9c00532fd48daa77b4fe9848aa640fe7b0de7a254eb215c2c2b34f697ef57b8613b4ddc
data/NEWS.md ADDED
@@ -0,0 +1,58 @@
1
+ factory_bot_rails versioning is synced with factory_bot releases. For this reason
2
+ there might not be any notable changes in new versions of this project.
3
+
4
+ # NEWS
5
+
6
+ ## 5.1.0 (September 24, 2019)
7
+ * Changed: factory_bot dependency to ~> 5.1.0
8
+
9
+ ## 5.0.2 (April 14, 2019)
10
+ * Bugfix: Reload factory\_bot whenever the application changes to avoid holding
11
+ onto stale object references
12
+ * Bugfix: Avoid watching project root when no factory definitions exist
13
+
14
+ ## 5.0.1 (February 9, 2019)
15
+ * Bugfix: Avoid watching files and directories that don't exist (to avoid a
16
+ file watching bug in Rails https://github.com/rails/rails/issues/32700)
17
+
18
+ ## 5.0.0 (February 1, 2019)
19
+ * Added: calling reload! in the Rails console will reload any factory definition files that have changed
20
+ * Added: support for custom generator templates
21
+ * Added: `definition_file_paths` configuration option, making it easier to place factories in custom locations
22
+ * Changed: namespaced models are now generated inside a directory matching the namespace
23
+ * Changed: added newline between factories generated into the same file
24
+ * Removed: support for EOL version of Ruby and Rails
25
+
26
+ ## 4.11.1 (September 7, 2018)
27
+ * Update generator to use dynamic attributes instead of deprecated static attributes
28
+
29
+ ## 4.11.0 (August 16, 2018)
30
+ * No notable changes
31
+
32
+ ## 4.10.0 (May 25, 2018)
33
+ * No notable changes
34
+
35
+ ## 4.8.2 (October 20, 2017)
36
+ * Rename factory\_girl\_rails to factory\_bot\_rails
37
+
38
+ ## 4.7.0 (April 1, 2016)
39
+ * No notable changes
40
+
41
+ ## 4.6.0 (February 1, 2016)
42
+ * No notable changes
43
+
44
+ ## 4.5.0 (October 17, 2014)
45
+ * Improved README
46
+
47
+ ## 4.4.1 (February 26, 2014)
48
+ * Support Spring
49
+
50
+ ## 4.2.1 (February 8, 2013)
51
+ * Fix bug when configuring FG and RSpec fixture directory
52
+ * Remove debugging
53
+ * Require factory\_girl\_rails explicitly in generator
54
+
55
+ ## 4.2.0 (January 25, 2013)
56
+ * Add appraisal and get test suite working reliably with turn gem
57
+ * Support MiniTest
58
+ * Allow a custom directory for factories to be specified
data/README.md CHANGED
@@ -66,9 +66,14 @@ This will cause factory\_bot\_rails to automatically load factories in
66
66
  It is possible to use this setting to share factories from a gem:
67
67
 
68
68
  ```rb
69
+ begin
70
+ require 'factory_bot_rails'
71
+ rescue LoadError
72
+ end
73
+
69
74
  class MyEngine < ::Rails::Engine
70
- config.factory_bot.definition_file_paths =
71
- File.expand_path('../factories', __FILE__) if defined?(FactoryBotRails)
75
+ config.factory_bot.definition_file_paths +=
76
+ [File.expand_path('../factories', __FILE__)] if defined?(FactoryBotRails)
72
77
  end
73
78
  ```
74
79
 
@@ -109,7 +114,7 @@ end
109
114
  ```
110
115
 
111
116
  Note that factory\_bot\_rails will not automatically load files in custom
112
- locations unless you add them to `config.factory_bot.defintion_file_paths` as
117
+ locations unless you add them to `config.factory_bot.definition_file_paths` as
113
118
  well.
114
119
 
115
120
  The suffix option allows you to customize the name of the generated file with a
@@ -19,5 +19,9 @@ module FactoryBotRails
19
19
  def files
20
20
  @files.select { |file| File.exist?(file) }
21
21
  end
22
+
23
+ def any?
24
+ directories.any? || files.any?
25
+ end
22
26
  end
23
27
  end
@@ -23,7 +23,7 @@ module FactoryBotRails
23
23
  end
24
24
 
25
25
  config.after_initialize do
26
- FactoryBot.find_definitions
26
+ FactoryBot.reload
27
27
  end
28
28
 
29
29
  private
@@ -7,9 +7,12 @@ module FactoryBotRails
7
7
  def initialize(app, config)
8
8
  @app = app
9
9
  @config = config
10
+ @paths = DefinitionFilePaths.new(FactoryBot.definition_file_paths)
10
11
  end
11
12
 
12
13
  def run
14
+ return unless @paths.any?
15
+
13
16
  register_reloader(build_reloader)
14
17
  end
15
18
 
@@ -18,9 +21,7 @@ module FactoryBotRails
18
21
  attr_reader :app, :config
19
22
 
20
23
  def build_reloader
21
- paths = DefinitionFilePaths.new(FactoryBot.definition_file_paths)
22
-
23
- reloader_class.new(paths.files, paths.directories) do
24
+ reloader_class.new(@paths.files, @paths.directories) do
24
25
  FactoryBot.reload
25
26
  end
26
27
  end
@@ -31,7 +32,7 @@ module FactoryBotRails
31
32
 
32
33
  def register_reloader(reloader)
33
34
  config.to_prepare do
34
- reloader.execute_if_updated
35
+ reloader.execute
35
36
  end
36
37
 
37
38
  app.reloaders << reloader
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factory_bot_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Ferris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-08 00:00:00.000000000 Z
11
+ date: 2019-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: factory_bot
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 5.0.0
19
+ version: 5.1.0
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: 5.0.0
26
+ version: 5.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -47,7 +47,7 @@ extra_rdoc_files: []
47
47
  files:
48
48
  - CONTRIBUTING.md
49
49
  - LICENSE
50
- - NEWS
50
+ - NEWS.md
51
51
  - README.md
52
52
  - lib/factory_bot_rails.rb
53
53
  - lib/factory_bot_rails/definition_file_paths.rb
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubygems_version: 3.0.1
82
+ rubygems_version: 3.0.3
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: factory_bot_rails provides integration between factory_bot and rails 4.2
data/NEWS DELETED
@@ -1,48 +0,0 @@
1
- factory_bot_rails versioning is synced with factory_bot releases. For this reason
2
- there might not be any notable changes in new versions of this project.
3
-
4
- 5.0.1
5
- Bugfix: Avoid watching files and directories that don't exist (to avoid a
6
- file watching bug in Rails https://github.com/rails/rails/issues/32700)
7
-
8
- 5.0.0
9
- Added: calling reload! in the Rails console will reload any factory definition files that have changed
10
- Added: support for custom generator templates
11
- Added: definition_file_paths configuration option, making it easier to place factories in custom locations
12
- Changed: namespaced models are now generated inside a directory matching the namespace
13
- Changed: added newline between factories generated into the same file
14
- Removed: support for EOL version of Ruby and Rails
15
-
16
- 4.11.1 (September 7, 2018)
17
- Update generator to use dynamic attributes instead of deprecated static attributes
18
-
19
- 4.11.0 (August 16, 2018)
20
- No notable changes
21
-
22
- 4.10.0 (May 25, 2018)
23
- No notable changes
24
-
25
- 4.8.2 (October 20, 2017)
26
- Rename factory_girl_rails to factory_bot_rails
27
-
28
- 4.7.0 (April 1, 2016)
29
- No notable changes
30
-
31
- 4.6.0 (February 1, 2016)
32
- No notable changes
33
-
34
- 4.5.0 (October 17, 2014)
35
- Improved README
36
-
37
- 4.4.1 (February 26, 2014)
38
- Support Spring
39
-
40
- 4.2.1 (February 8, 2013)
41
- Fix bug when configuring FG and RSpec fixture directory
42
- Remove debugging
43
- Require factory_girl_rails explicitly in generator
44
-
45
- 4.2.0 (January 25, 2013)
46
- Add appraisal and get test suite working reliably with turn gem
47
- Support MiniTest
48
- Allow a custom directory for factories to be specified