Spec helper configuration problem

Hi all,

I have a rails application whose specs run on about eight different
boxes,
but I can’t get them to work on my integration server. The bit thats
breaking concerns some modules that I have in spec/support/modules which
are
loaded by
the following line in spec_helper

# get any macros etc
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require 

f}

one of these modules includes the other modules, and this generates the
following stacktrace

 /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:440:in

load_missing_constant': uninitialized constant OrderSpecHelper::BasketSpecHelper (NameError) from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:inconst_missing’
from ./spec/helpers/…/support/modules/order_spec_helper.rb:2
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in
`require’

the line causing this is order_spec_helper.rb:2

module OrderSpecHelper
include BasketSpecHelper

and BasketSpecHelper is defined in
/support/modules/basket_spec_helper.rb

and is coded something like

module BasketSpecHelper

I wonder if anyone has any ideas about the cause of this problem or some
ideas about possible solutions

Many thanks

Andrew

Andrew P. wrote:

...

I wonder if anyone has any ideas about the cause of this problem or
some ideas about possible solutions

I’ve ran into similar issues. The problem in my case was the my
integration server was running linux but our dev boxes were OSx. The
issue was file ordering being different for the Dir::[] method on the
OSes. Try adding a sort call like so:

Dir[File.dirname(FILE) + “/support/**/*.rb”].sort.each {|f| require
f}

HTH,
Ben

2009/11/27 Ben M. [email protected]

get any macros etc

/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:in

HTH,
Ben


rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Ben,

That fixed it :slight_smile: many thanks once again

All best

Andrew