You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran the corrector w/ this cop on our codebase, using the explicit style. It made one correction which broke factorybot.
I wrote a test that reproduced the behavior below.
The problem is a nested factory that looks like factory :active_article, traits: [:approved, :active] and:
It gets identified as an error (should it be?)
It gets corrected to association :factory, :active_article, traits: [:active, :approved] which breaks the factory
The interesting thing is if I just add a do;end block to my :active_article factory, it ignores the error. I have a draft PR I'm going to push up shortly.
context 'when implicit association has factory and traits' do
it 'registers and corrects an offense' do
expect_no_offenses(<<~RUBY)
factory :article do
traits :approved do
approved { true }
end
traits :active do
active { true }
end
factory :active_article, traits: [:approved, :active]
end
RUBY
end
end
The text was updated successfully, but these errors were encountered:
I ran the corrector w/ this cop on our codebase, using the
explicit
style. It made one correction which broke factorybot.I wrote a test that reproduced the behavior below.
The problem is a nested factory that looks like
factory :active_article, traits: [:approved, :active]
and:association :factory, :active_article, traits: [:active, :approved]
which breaks the factoryThe interesting thing is if I just add a
do;end
block to my:active_article
factory, it ignores the error. I have a draft PR I'm going to push up shortly.The text was updated successfully, but these errors were encountered: