factory_bot 5.1.1 → 5.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/GETTING_STARTED.md +4 -4
- data/NEWS.md +3 -0
- data/README.md +1 -1
- data/lib/factory_bot.rb +1 -1
- data/lib/factory_bot/attribute/dynamic.rb +1 -0
- data/lib/factory_bot/configuration.rb +1 -1
- data/lib/factory_bot/decorator.rb +1 -1
- data/lib/factory_bot/decorator/invocation_tracker.rb +1 -1
- data/lib/factory_bot/definition.rb +1 -1
- data/lib/factory_bot/definition_proxy.rb +1 -1
- data/lib/factory_bot/evaluator.rb +1 -1
- data/lib/factory_bot/internal.rb +4 -4
- data/lib/factory_bot/linter.rb +4 -4
- data/lib/factory_bot/null_factory.rb +1 -1
- data/lib/factory_bot/registry.rb +2 -2
- data/lib/factory_bot/version.rb +1 -1
- metadata +35 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af563cbc6de86098293f6454faa0bb33751a61c0848597b67839f122620cd809
|
4
|
+
data.tar.gz: d68bd5a9eeb57667036e61159a6b289ed89d28a6d9c46e88aadd688fffa4fadd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acfcdaabe87c3c551093a11449b5a6f5e7a9ccb340ced5fb9d8fb2fb3fb1e207d3a7232abc3a9cde37b0038e894b8d3fe493b9e0a867f7e77b9de2ca60c35532
|
7
|
+
data.tar.gz: 902f2234e9ead09c891399d098c663624bce10f3d56335262e0ee38c17ff60096d061db800ea82c928005e5085a043b51f8f83799d6cd0d4587006237fad9dc6
|
data/GETTING_STARTED.md
CHANGED
@@ -119,7 +119,7 @@ It is also possible to explicitly specify the class:
|
|
119
119
|
|
120
120
|
```ruby
|
121
121
|
# This will use the User class (otherwise Admin would have been guessed)
|
122
|
-
factory :admin, class: User
|
122
|
+
factory :admin, class: "User"
|
123
123
|
```
|
124
124
|
|
125
125
|
If the constant is not available
|
@@ -1066,7 +1066,7 @@ Example Rake task:
|
|
1066
1066
|
namespace :factory_bot do
|
1067
1067
|
desc "Verify that all FactoryBot factories are valid"
|
1068
1068
|
task lint: :environment do
|
1069
|
-
if Rails.env.test?
|
1069
|
+
if Rails.env.test?
|
1070
1070
|
conn = ActiveRecord::Base.connection
|
1071
1071
|
conn.transaction do
|
1072
1072
|
FactoryBot.lint
|
@@ -1413,12 +1413,12 @@ with associations, as below:
|
|
1413
1413
|
|
1414
1414
|
```ruby
|
1415
1415
|
FactoryBot.define do
|
1416
|
-
factory :united_states, class: Location do
|
1416
|
+
factory :united_states, class: "Location" do
|
1417
1417
|
name { 'United States' }
|
1418
1418
|
association :location_group, factory: :north_america
|
1419
1419
|
end
|
1420
1420
|
|
1421
|
-
factory :north_america, class: LocationGroup do
|
1421
|
+
factory :north_america, class: "LocationGroup" do
|
1422
1422
|
name { 'North America' }
|
1423
1423
|
end
|
1424
1424
|
end
|
data/NEWS.md
CHANGED
data/README.md
CHANGED
@@ -89,7 +89,7 @@ software, and may be redistributed under the terms specified in the
|
|
89
89
|
About thoughtbot
|
90
90
|
----------------
|
91
91
|
|
92
|
-
![thoughtbot](https://
|
92
|
+
![thoughtbot](https://thoughtbot.com/brand_assets/93:44.svg)
|
93
93
|
|
94
94
|
factory_bot is maintained and funded by thoughtbot, inc.
|
95
95
|
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
data/lib/factory_bot.rb
CHANGED
@@ -6,7 +6,7 @@ module FactoryBot
|
|
6
6
|
@component = component
|
7
7
|
end
|
8
8
|
|
9
|
-
def method_missing(name, *args, &block) # rubocop:disable Style/
|
9
|
+
def method_missing(name, *args, &block) # rubocop:disable Style/MethodMissingSuper
|
10
10
|
@component.send(name, *args, &block)
|
11
11
|
end
|
12
12
|
|
@@ -49,7 +49,7 @@ module FactoryBot
|
|
49
49
|
|
50
50
|
defined_traits.each do |defined_trait|
|
51
51
|
base_traits.each { |bt| bt.define_trait defined_trait }
|
52
|
-
additional_traits.each { |
|
52
|
+
additional_traits.each { |at| at.define_trait defined_trait }
|
53
53
|
end
|
54
54
|
|
55
55
|
@compiled = true
|
@@ -88,7 +88,7 @@ module FactoryBot
|
|
88
88
|
# end
|
89
89
|
#
|
90
90
|
# are equivalent.
|
91
|
-
def method_missing(name, *args, &block) # rubocop:disable Style/
|
91
|
+
def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing, Style/MethodMissingSuper, Metrics/LineLength
|
92
92
|
association_options = args.first
|
93
93
|
|
94
94
|
if association_options.nil?
|
@@ -37,7 +37,7 @@ module FactoryBot
|
|
37
37
|
@instance = object_instance
|
38
38
|
end
|
39
39
|
|
40
|
-
def method_missing(method_name, *args, &block) # rubocop:disable Style/
|
40
|
+
def method_missing(method_name, *args, &block) # rubocop:disable Style/MethodMissingSuper
|
41
41
|
if @instance.respond_to?(method_name)
|
42
42
|
@instance.send(method_name, *args, &block)
|
43
43
|
else
|
data/lib/factory_bot/internal.rb
CHANGED
@@ -2,11 +2,11 @@ module FactoryBot
|
|
2
2
|
# @api private
|
3
3
|
module Internal
|
4
4
|
DEFAULT_STRATEGIES = {
|
5
|
-
build:
|
6
|
-
create:
|
5
|
+
build: FactoryBot::Strategy::Build,
|
6
|
+
create: FactoryBot::Strategy::Create,
|
7
7
|
attributes_for: FactoryBot::Strategy::AttributesFor,
|
8
|
-
build_stubbed:
|
9
|
-
null:
|
8
|
+
build_stubbed: FactoryBot::Strategy::Stub,
|
9
|
+
null: FactoryBot::Strategy::Null,
|
10
10
|
}.freeze
|
11
11
|
|
12
12
|
DEFAULT_CALLBACKS = [
|
data/lib/factory_bot/linter.rb
CHANGED
@@ -72,8 +72,8 @@ module FactoryBot
|
|
72
72
|
result = []
|
73
73
|
begin
|
74
74
|
FactoryBot.public_send(factory_strategy, factory.name)
|
75
|
-
rescue StandardError =>
|
76
|
-
result |= [FactoryError.new(
|
75
|
+
rescue StandardError => e
|
76
|
+
result |= [FactoryError.new(e, factory)]
|
77
77
|
end
|
78
78
|
result
|
79
79
|
end
|
@@ -83,9 +83,9 @@ module FactoryBot
|
|
83
83
|
factory.definition.defined_traits.map(&:name).each do |trait_name|
|
84
84
|
begin
|
85
85
|
FactoryBot.public_send(factory_strategy, factory.name, trait_name)
|
86
|
-
rescue StandardError =>
|
86
|
+
rescue StandardError => e
|
87
87
|
result |=
|
88
|
-
[FactoryTraitError.new(
|
88
|
+
[FactoryTraitError.new(e, factory, trait_name)]
|
89
89
|
end
|
90
90
|
end
|
91
91
|
result
|
data/lib/factory_bot/registry.rb
CHANGED
data/lib/factory_bot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.1.
|
4
|
+
version: 5.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Clayton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -127,16 +127,44 @@ dependencies:
|
|
127
127
|
name: rubocop
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: rubocop-performance
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
131
152
|
- !ruby/object:Gem::Version
|
132
|
-
version: '0
|
153
|
+
version: '0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: rubocop-rails
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
133
161
|
type: :development
|
134
162
|
prerelease: false
|
135
163
|
version_requirements: !ruby/object:Gem::Requirement
|
136
164
|
requirements:
|
137
|
-
- -
|
165
|
+
- - ">="
|
138
166
|
- !ruby/object:Gem::Version
|
139
|
-
version: '0
|
167
|
+
version: '0'
|
140
168
|
- !ruby/object:Gem::Dependency
|
141
169
|
name: simplecov
|
142
170
|
requirement: !ruby/object:Gem::Requirement
|
@@ -251,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
279
|
- !ruby/object:Gem::Version
|
252
280
|
version: '0'
|
253
281
|
requirements: []
|
254
|
-
rubygems_version: 3.
|
282
|
+
rubygems_version: 3.1.2
|
255
283
|
signing_key:
|
256
284
|
specification_version: 4
|
257
285
|
summary: factory_bot provides a framework and DSL for defining and using model instance
|