diff options
author | Adam Jacob <adam@hjksolutions.com> | 2009-01-06 23:29:10 -0800 |
---|---|---|
committer | Adam Jacob <adam@hjksolutions.com> | 2009-01-06 23:29:10 -0800 |
commit | 03626d265182278756c022a06996dbe24e5f8500 (patch) | |
tree | ab4cca210b90816a2c28c77030ea669ab91792f1 /chef/spec/spec_helper.rb | |
parent | 1ed30218fcb48c6ec9092f354af8d536ab30ac59 (diff) | |
download | chef-03626d265182278756c022a06996dbe24e5f8500.tar.gz |
Fixing spec require so that it does't cause bogus constant redefinition
Diffstat (limited to 'chef/spec/spec_helper.rb')
-rw-r--r-- | chef/spec/spec_helper.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/chef/spec/spec_helper.rb b/chef/spec/spec_helper.rb index d552559960..4308f5f8f7 100644 --- a/chef/spec/spec_helper.rb +++ b/chef/spec/spec_helper.rb @@ -17,8 +17,21 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # -require File.join(File.dirname(__FILE__), "..", "lib", "chef") -Dir[File.join(File.dirname(__FILE__), '..', 'lib', 'chef', '**', '*.rb')].sort.each { |lib| require lib } +$:.unshift(File.join(File.dirname(__FILE__), "..", "lib")) + +require 'chef' + +chef_lib_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) +Dir[ + File.expand_path( + File.join( + chef_lib_path, 'chef', '**', '*.rb' + ) + ) +].sort.each do |lib| + lib_short_path = lib.match("^#{chef_lib_path}#{File::SEPARATOR}(.+)$")[1] + require lib_short_path +end Dir[File.join(File.dirname(__FILE__), 'lib', '**', '*.rb')].sort.each { |lib| require lib } Chef::Config.log_level(:error) |