Skip to content

If shared_examples block has example metadata they are running in other specs #1241

@dennisfoconnor

Description

@dennisfoconnor

This problem only occurs when running the full set of specs on the rails project. When a shared_examples block has identical example metadata as the top-level describe block in another spec, those examples are automatically included in that spec as well.

Work Around: Move the example metadata inside the shared_example, either directly on the tests or in a describe block.

Using rspec-rails 3.1.0

Code example:

describe FooController, example_field: 'Foobar' do
   it 'will run this test' do
   ....
   end
end

describe Bar do
   shared_examples 'some shared example, example_field: 'Foobar' do
        it 'will also run this test' do
         ....
       end 
   end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions