File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
spec/rubocop/cop/rspec/factory_bot Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 1717 end
1818
1919 it "registers an offense for `FactoryBot.#{ method } `" do
20- expect_offense ( <<~RUBY )
20+ expect_offense ( <<~RUBY , method : method )
2121 describe Foo do
22- let(:bar) { FactoryBot.# {method } (:bar) }
23- ^^^^^^^^^^^#{ '^' * method . length } Use `# {method } ` from `FactoryBot::Syntax::Methods`.
22+ let(:bar) { FactoryBot.% {method}(:bar) }
23+ ^^^^^^^^^^^^{ method} Use `% {method}` from `FactoryBot::Syntax::Methods`.
2424 end
2525 RUBY
2626
3232 end
3333
3434 it "registers an offense for `FactoryBot.#{ method } ` in a shared group" do
35- expect_offense ( <<~RUBY )
35+ expect_offense ( <<~RUBY , method : method )
3636 shared_examples_for Foo do
37- let(:bar) { FactoryBot.# {method } (:bar) }
38- ^^^^^^^^^^^#{ '^' * method . length } Use `# {method } ` from `FactoryBot::Syntax::Methods`.
37+ let(:bar) { FactoryBot.% {method}(:bar) }
38+ ^^^^^^^^^^^^{ method} Use `% {method}` from `FactoryBot::Syntax::Methods`.
3939 end
4040 RUBY
4141
4747 end
4848
4949 it "registers an offense for `::FactoryBot.#{ method } `" do
50- expect_offense ( <<~RUBY )
50+ expect_offense ( <<~RUBY , method : method )
5151 RSpec.describe Foo do
52- let(:bar) { ::FactoryBot.# {method } (:bar) }
53- ^^^^^^^^^^^^^#{ '^' * method . length } Use `# {method } ` from `FactoryBot::Syntax::Methods`.
52+ let(:bar) { ::FactoryBot.% {method}(:bar) }
53+ ^^^^^^^^^^^^^^{ method} Use `% {method}` from `FactoryBot::Syntax::Methods`.
5454 end
5555 RUBY
5656
You can’t perform that action at this time.
0 commit comments