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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d19c695ef0088d163b82c6b32066d4385d4be7fb8c0dc0b29c350d2e2187f2d
4
- data.tar.gz: 55270eb96b553aa9b0c186bc7eeaf9d084fc79252b7fb8443d6276b1865168cc
3
+ metadata.gz: af563cbc6de86098293f6454faa0bb33751a61c0848597b67839f122620cd809
4
+ data.tar.gz: d68bd5a9eeb57667036e61159a6b289ed89d28a6d9c46e88aadd688fffa4fadd
5
5
  SHA512:
6
- metadata.gz: d61c40f944ae69e27a32e0992d8c289e9d0d9d5a48efe2998b8c53eca17be8a3591f886762866155032662e0eb32a4d52f342cfc1c88b22e637cab3d6e999f81
7
- data.tar.gz: 2aa21a35633016a9e9871c9e56782af137a209ad1c155d51d768ba129d5dea016c54f9d1186191d2ed24e616f5d6516b78698488b8ee536fd929e28c7055ff1f
6
+ metadata.gz: acfcdaabe87c3c551093a11449b5a6f5e7a9ccb340ced5fb9d8fb2fb3fb1e207d3a7232abc3a9cde37b0038e894b8d3fe493b9e0a867f7e77b9de2ca60c35532
7
+ data.tar.gz: 902f2234e9ead09c891399d098c663624bce10f3d56335262e0ee38c17ff60096d061db800ea82c928005e5085a043b51f8f83799d6cd0d4587006237fad9dc6
@@ -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
@@ -1,5 +1,8 @@
1
1
  # News
2
2
 
3
+ ## 5.1.2 (March 25, 2020)
4
+ * Fixed: Ruby 2.7 keyword deprecation warning in FactoryBot.lint
5
+
3
6
  ## 5.1.1 (October 2, 2019)
4
7
  * Improved: performance of traits
5
8
  * Fixed: registering strategies on JRuby
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://presskit.thoughtbot.com/images/thoughtbot-logo-for-readmes.svg)
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.
@@ -71,7 +71,7 @@ module FactoryBot
71
71
  def self.lint(*args)
72
72
  options = args.extract_options!
73
73
  factories_to_lint = args[0] || FactoryBot.factories
74
- Linter.new(factories_to_lint, options).lint!
74
+ Linter.new(factories_to_lint, **options).lint!
75
75
  end
76
76
 
77
77
  class << self
@@ -16,6 +16,7 @@ module FactoryBot
16
16
  else instance_exec(&block)
17
17
  end
18
18
  raise SequenceAbuseError if FactoryBot::Sequence === value
19
+
19
20
  value
20
21
  }
21
22
  end
@@ -24,7 +24,7 @@ module FactoryBot
24
24
  end
25
25
 
26
26
  delegate :to_create, :skip_create, :constructor, :before, :after,
27
- :callback, :callbacks, to: :@definition
27
+ :callback, :callbacks, to: :@definition
28
28
 
29
29
  def initialize_with(&block)
30
30
  @definition.define_constructor(&block)
@@ -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/MethodMissing
9
+ def method_missing(name, *args, &block) # rubocop:disable Style/MethodMissingSuper
10
10
  @component.send(name, *args, &block)
11
11
  end
12
12
 
@@ -6,7 +6,7 @@ module FactoryBot
6
6
  @invoked_methods = []
7
7
  end
8
8
 
9
- def method_missing(name, *args, &block) # rubocop:disable Style/MethodMissing
9
+ def method_missing(name, *args, &block) # rubocop:disable Style/MissingRespondToMissing
10
10
  @invoked_methods << name
11
11
  super
12
12
  end
@@ -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 { |bt| bt.define_trait defined_trait }
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/MethodMissing
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/MethodMissing
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
@@ -2,11 +2,11 @@ module FactoryBot
2
2
  # @api private
3
3
  module Internal
4
4
  DEFAULT_STRATEGIES = {
5
- build: FactoryBot::Strategy::Build,
6
- create: FactoryBot::Strategy::Create,
5
+ build: FactoryBot::Strategy::Build,
6
+ create: FactoryBot::Strategy::Create,
7
7
  attributes_for: FactoryBot::Strategy::AttributesFor,
8
- build_stubbed: FactoryBot::Strategy::Stub,
9
- null: FactoryBot::Strategy::Null,
8
+ build_stubbed: FactoryBot::Strategy::Stub,
9
+ null: FactoryBot::Strategy::Null,
10
10
  }.freeze
11
11
 
12
12
  DEFAULT_CALLBACKS = [
@@ -72,8 +72,8 @@ module FactoryBot
72
72
  result = []
73
73
  begin
74
74
  FactoryBot.public_send(factory_strategy, factory.name)
75
- rescue StandardError => error
76
- result |= [FactoryError.new(error, factory)]
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 => error
86
+ rescue StandardError => e
87
87
  result |=
88
- [FactoryTraitError.new(error, factory, trait_name)]
88
+ [FactoryTraitError.new(e, factory, trait_name)]
89
89
  end
90
90
  end
91
91
  result
@@ -8,7 +8,7 @@ module FactoryBot
8
8
  end
9
9
 
10
10
  delegate :defined_traits, :callbacks, :attributes, :constructor,
11
- :to_create, to: :definition
11
+ :to_create, to: :definition
12
12
 
13
13
  def compile; end
14
14
 
@@ -21,8 +21,8 @@ module FactoryBot
21
21
 
22
22
  def find(name)
23
23
  @items.fetch(name)
24
- rescue KeyError => key_error
25
- raise key_error_with_custom_message(key_error)
24
+ rescue KeyError => e
25
+ raise key_error_with_custom_message(e)
26
26
  end
27
27
 
28
28
  alias :[] :find
@@ -1,3 +1,3 @@
1
1
  module FactoryBot
2
- VERSION = "5.1.1".freeze
2
+ VERSION = "5.1.2".freeze
3
3
  end
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.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: 2019-10-02 00:00:00.000000000 Z
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.54'
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.54'
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.0.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