Skip to content

deprecation warnings when spec enclosed in a module

gitlab-qa-bot requested to merge fix_toplevel_definition_in_modules into master

Created by: JonRowe

Since upgrade to RSpec 2.14, when I enclose a spec in a module (I'm testing functionality of this module and I don't want to fully qualify each class/constant I use) like this:

module MyModule
  shared_context 'shared context' do    
  end

  describe 'something' do
    include_context 'shared context'
  end
end

I get this deprecation warning:

Accessing shared_examples defined across contexts is deprecated.
Please declare shared_examples within a shared context, or at the top level.

for every shared_examples/shared_context, which obviously isn't what's happening.

Merge request reports