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:in `const_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:in `require'' 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091127/6d55573b/attachment.html>
Andrew Premdas wrote:> 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:in `const_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:in `require'' > 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 solutionsI''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 Mabey <ben at benmabey.com>> Andrew Premdas wrote: > >> 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:in >> `const_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:in >> `require'' >> 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 >> > > 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 > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >Ben, That fixed it :) many thanks once again All best Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091130/e3f0725c/attachment.html>