spec/rubocop/cop/rspec/describe_method_spec.rb in rubocop-rspec-1.5.1 vs spec/rubocop/cop/rspec/describe_method_spec.rb in rubocop-rspec-1.5.2
- old
+ new
@@ -1,11 +1,18 @@
-# encoding: utf-8
-
describe RuboCop::Cop::RSpec::DescribeMethod do
subject(:cop) { described_class.new }
+ it 'ignores describes with only a class' do
+ inspect_source(cop, 'describe Some::Class do; end')
+ expect(cop.offenses.empty?).to be(true)
+ end
+
it 'enforces non-method names' do
- inspect_source(cop, "describe Some::Class, 'nope' do; end")
+ inspect_source(
+ cop,
+ "describe Some::Class, 'nope', '.incorrect_usage' do; end"
+ )
+
expect(cop.offenses.size).to eq(1)
expect(cop.offenses.map(&:line).sort).to eq([1])
expect(cop.messages)
.to eq(['The second argument to describe should be the method being ' \
"tested. '#instance' or '.class'"])