-
-
Notifications
You must be signed in to change notification settings - Fork 282
Closed
Description
Expected behavior
When declaring my factories using FactoryBot gem, I want to be able to use an attribute called example
without Rubocop complaining about expectations.
Actual behavior
FactoryBot.define do
factory :word_function_meaning, class: "Word::Function::Meaning" do
...
trait :with_admin_update_attributes do
definition { Faker::Lorem.sentence(word_count: rand(4..8)) }
example { definition }
end
...
end
end
Offenses:
spec/factories/word/function/meanings.rb:15:7: C: RSpec/NoExpectationExample: No expectation found in this example.
example { definition }
^^^^^^^^^^^^^^^^^^^^^^
Here, I need to add # rubocop:disable RSpec/NoExpectationExample
around the example { definition }
line because I am getting a RSpec/NoExpectationExample: No expectation found in this example.
.
Steps to reproduce the problem
See above.
RuboCop RSpec version
Include the output of rubocop -V
or bundle exec rubocop -V
if using Bundler.
If you see extension cop versions (e.g. rubocop-performance
, rubocop-rake
, and others)
output by rubocop -V
, include them as well. Here's an example:
$ [bundle exec] rubocop -V
1.78.0 (using Parser 3.3.8.0, Prism 1.4.0, rubocop-ast 1.45.1, analyzing as Ruby 3.4, running on ruby 3.4.3) [arm64-darwin24]
- rubocop-factory_bot 2.27.1
- rubocop-performance 1.25.0
- rubocop-rails 2.32.0
- rubocop-rspec 3.6.0
- rubocop-rspec_rails 2.31.0
- rubocop-slim 0.3.0
Metadata
Metadata
Assignees
Labels
No labels