rubocop-rspec 1.29.0 → 1.29.1

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: 443658797afd25742895f47e865522055e00c498fb74ca74fda1d09468d86470
4
- data.tar.gz: 71e9ab9356e4287df026b2d051bc2de4407517021c62c28cc66dfb5164dda753
3
+ metadata.gz: 5bb37f4e34447ecf1e1f30484aa0d861a624e71e60b2c21d16c67f5a20d95b13
4
+ data.tar.gz: db2a1555891ba75ac4ee956c6e9d97e85b95923edde3e7584f818d2fe2cddc85
5
5
  SHA512:
6
- metadata.gz: 714551b4c0b85485ed5a0b0bdfc67cbca73b16fbb2a1ca5b498f578f928a04fe2ab58d1d9916bd140c64a62e23d81e9ea66944c294a98486776df9f204a2ba8f
7
- data.tar.gz: 5b373a20f346018dd9cdf242e615e997b64d5803e77fd4fa434f346cb423366f199ee9597a3bf1515d238a16bf0e1cfc8178980d681e652a3352d78f003f1bbd
6
+ metadata.gz: 7db598400632086657e6b590ff999aee6a9ce46e3443edaa133af3e8d0411d0669a2ed360cc05360b8748c6694ad0d5a3dd5783dc39e06be7136dcf8554673e4
7
+ data.tar.gz: 83815cc74d3261b5e05cb0d3ab760dfa0c5c3448ac0595d70392ed4d45d9ccc388c1026ae4202a72128c5945976d6eba04ac60f0729fc8c0f4df8b5a2c63e2c0
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Master (Unreleased)
4
4
 
5
+ ## 1.29.1 (2018-09-01)
6
+
7
+ * Fix false negative in `FactoryBot/AttributeDefinedStatically` when attribute is defined on `self`. ([@Darhazer][])
8
+ * `RSpec/FactoryBot` cops will now also inspect the `spec/factories.rb` path by default. ([@bquorning][])
9
+
5
10
  ## 1.29.0 (2018-08-25)
6
11
 
7
12
  * `RSpec/InstanceVariable` - Recommend local variables in addition to `let`. ([@jaredbeck][])
@@ -6,6 +6,7 @@ AllCops:
6
6
  - "(?:^|/)spec/"
7
7
  RSpec/FactoryBot:
8
8
  Patterns:
9
+ - spec/factories.rb
9
10
  - spec/factories/**/*.rb
10
11
  - features/support/factories/**/*.rb
11
12
 
@@ -63,7 +63,7 @@ module RuboCop
63
63
  ATTRIBUTE_DEFINING_METHODS
64
64
 
65
65
  def_node_matcher :value_matcher, <<-PATTERN
66
- (send nil? !#reserved_method? $...)
66
+ (send {self nil?} !#reserved_method? $...)
67
67
  PATTERN
68
68
 
69
69
  def_node_search :factory_attributes, <<-PATTERN
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module RSpec
5
5
  # Version information for the RSpec RuboCop plugin.
6
6
  module Version
7
- STRING = '1.29.0'.freeze
7
+ STRING = '1.29.1'.freeze
8
8
  end
9
9
  end
10
10
  end
@@ -54,6 +54,18 @@ RSpec.describe RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically do #
54
54
  RUBY
55
55
  end
56
56
 
57
+ it 'registers an offense for an attribute defined on `self`' do
58
+ expect_offense(<<-RUBY)
59
+ FactoryBot.define do
60
+ factory :post do
61
+ self.start { Date.today }
62
+ self.end Date.tomorrow
63
+ ^^^^^^^^^^^^^^^^^^^^^^ Use a block to declare attribute values.
64
+ end
65
+ end
66
+ RUBY
67
+ end
68
+
57
69
  it 'accepts valid factory definitions' do
58
70
  expect_no_offenses(<<-RUBY)
59
71
  FactoryBot.define do
@@ -121,6 +133,7 @@ RSpec.describe RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically do #
121
133
  meta_tags(foo: Time.current)
122
134
  other_tags({ foo: Time.current })
123
135
  options color: :blue
136
+ self.end Date.tomorrow
124
137
 
125
138
  trait :old do
126
139
  published_at 1.week.ago
@@ -144,6 +157,7 @@ RSpec.describe RuboCop::Cop::RSpec::FactoryBot::AttributeDefinedStatically do #
144
157
  meta_tags { { foo: Time.current } }
145
158
  other_tags { { foo: Time.current } }
146
159
  options { { color: :blue } }
160
+ self.end { Date.tomorrow }
147
161
 
148
162
  trait :old do
149
163
  published_at { 1.week.ago }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.29.0
4
+ version: 1.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Backus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-08-25 00:00:00.000000000 Z
13
+ date: 2018-09-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubocop