RSpec/MultipleExpectationsを回避
解決
aggregate_failures を使用する
it "正常動作する" do subject aggregate_failures "最後まで通過" do expect(job_instance).to have_received(:hoge1) expect(job_instance).to have_received(:hoge2).at_least(1).times end end 事象
it "正常動作する" do subject expect(job_instance).to have_received(:hoge1) expect(job_instance).to have_received(:hoge2).at_least(1).times end をrubocopで検査すると下記のエラーが発生する
spec/jobs/hoge.rb:35:5: C: RSpec/MultipleExpectations: Example has too many expectations [2/1]. it "正常動作する" do ^^^^^^^^^^^ Class: RuboCop::Cop::RSpec::EmptyExampleGroup — Documentation for rubocop-rspec (1.7.0)
This post is licensed under CC BY 4.0 by the author.