spec/rubocop/cop/rspec/describe_class_spec.rb in rubocop-rspec-1.8.0 vs spec/rubocop/cop/rspec/describe_class_spec.rb in rubocop-rspec-1.9.0
- old
+ new
@@ -108,6 +108,42 @@
end
it "doesn't blow up on single-line describes" do
expect_no_violations('describe Some::Class')
end
+
+ it "doesn't flag top level describe in a shared example" do
+ expect_no_violations(<<-RUBY)
+ shared_examples 'Common::Interface' do
+ describe '#public_interface' do
+ it 'conforms to interface' do
+ # ...
+ end
+ end
+ end
+ RUBY
+ end
+
+ it "doesn't flag top level describe in a shared context" do
+ expect_no_violations(<<-RUBY)
+ RSpec.shared_context 'Common::Interface' do
+ describe '#public_interface' do
+ it 'conforms to interface' do
+ # ...
+ end
+ end
+ end
+ RUBY
+ end
+
+ it "doesn't flag top level describe in an unnamed shared context" do
+ expect_no_violations(<<-RUBY)
+ shared_context do
+ describe '#public_interface' do
+ it 'conforms to interface' do
+ # ...
+ end
+ end
+ end
+ RUBY
+ end
end