spec/spec_helper.rb in methodmissing-scrooge-1.0.2 vs spec/spec_helper.rb in methodmissing-scrooge-1.0.3
- old
+ new
@@ -9,12 +9,16 @@
#ActiveRecord::Base.logger = Logger.new(StringIO.new)
Spec::Runner.configure do |config|
- Kernel.const_set :FIXTURES, "#{Dir.pwd}/spec/fixtures" unless defined?(FIXTURES)
- Kernel.const_set :TMP, "#{Dir.pwd}/spec/tmp" unless defined?(TMP)
- Kernel.const_set :CONFIG, "#{Dir.pwd}/spec/config" unless defined?(CONFIG)
+ def self.set_constant( const, value )
+ eval( "Kernel.const_set :#{const.to_s}, #{value.inspect} unless defined?( #{const.to_s} )" )
+ end
+
+ set_constant( :FIXTURES, "#{Dir.pwd}/spec/fixtures" )
+ set_constant( :TMP, "#{Dir.pwd}/spec/tmp" )
+ set_constant( :CONFIG, "#{Dir.pwd}/spec/config" )
config.before :all do
[TMP, CONFIG].each do |dir|
FileUtils.mkdir_p dir
end
\ No newline at end of file