spec/rubocop/cop/rspec/context_wording_spec.rb in rubocop-rspec-1.32.0 vs spec/rubocop/cop/rspec/context_wording_spec.rb in rubocop-rspec-1.33.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + RSpec.describe RuboCop::Cop::RSpec::ContextWording, :config do subject(:cop) { described_class.new(config) } let(:cop_config) { { 'Prefixes' => %w[when with] } } @@ -37,9 +39,39 @@ expect_offense(<<-RUBY) context 'whenever you do' do ^^^^^^^^^^^^^^^^^ Start context description with 'when', or 'with'. end RUBY + end + + context 'with metadata hash' do + it 'finds context without separate `when` at the beginning' do + expect_offense(<<-RUBY) + context 'whenever you do', legend: true do + ^^^^^^^^^^^^^^^^^ Start context description with 'when', or 'with'. + end + RUBY + end + end + + context 'with symbol metadata' do + it 'finds context without separate `when` at the beginning' do + expect_offense(<<-RUBY) + context 'whenever you do', :legend do + ^^^^^^^^^^^^^^^^^ Start context description with 'when', or 'with'. + end + RUBY + end + end + + context 'with mixed metadata' do + it 'finds context without separate `when` at the beginning' do + expect_offense(<<-RUBY) + context 'whenever you do', :legend, myth: true do + ^^^^^^^^^^^^^^^^^ Start context description with 'when', or 'with'. + end + RUBY + end end context 'when configured' do let(:cop_config) { { 'Prefixes' => %w[if] } }