[rspec-users] Shared Examples + “initialized constant” warnings

Gerrit Kaiser gerrit+rspec-devel at gerritkaiser.de
Fri Feb 8 00:41:07 EST 2008

Hi List,
I'm using rspec's shared example groups in a rails project (rails  
2.02, rspec(on_rails) 1.1.3) and I'm getting lots of errors of the  
following kind when(before) running the specs:

warning: already initialized constant ContentExamples
warning: already initialized constant EditViewExamples

The shared example groups are defined in files like spec/shared/ 
and declared as
share_as :FooExamples do…end
(and then included in other example groups with "include FooExamples")
They're loaded in spec_helper.rb with the following:
Dir.glob(File.join(File.dirname(__FILE__), 'shared', '*.rb')).each do | 
   require shared_example

I'm guessing that's what needs to change. Has anyone else seen these  
warnings? I find them quite annoying and would like to get rid of  
them. Any pointers would be much appreciated.

More information about the rspec-users mailing list