spec/spec_helper.rb in shenandoah-0.1.0 vs spec/spec_helper.rb in shenandoah-0.1.1
- old
+ new
@@ -1,27 +1,42 @@
require 'spec'
require 'rubygems'
+# Rake needs to be locked to the version that buildr expects before
+# anything else loads and gets the most recent installed version
+SHEN_RAKE_VERSION = '0.8.4'
+gem 'rake', "= #{SHEN_RAKE_VERSION}"
-$LOAD_PATH.unshift(File.dirname(__FILE__))
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-
Spec::Runner.configure do |config|
end
module Shenandoah
module Spec
+ def self.load_path_additions
+ [
+ File.dirname(__FILE__),
+ File.join(File.dirname(__FILE__), '..', 'lib')
+ ]
+ end
+
module Tmpfile
attr_writer :tmpdir
def tmpfile(name, contents="contents not important")
n = "#{tmpdir}/#{name}"
FileUtils.mkdir_p File.dirname(n)
File.open(n, 'w') { |f| f.write contents }
n
end
+ def tmpscript(name, contents)
+ tmpfile name,
+ Shenandoah::Spec.load_path_additions.
+ map { |a| "$LOAD_PATH.unshift(#{a.inspect})" }.
+ join("\n") + "\n" + contents
+ end
+
def tmpdir(name=nil)
n = @tmpdir
if (name)
n = File.join(n, name)
FileUtils.mkdir_p(n)
@@ -56,6 +71,8 @@
end
end
end
end
end
-end
\ No newline at end of file
+end
+
+Shenandoah::Spec.load_path_additions.each { |p| $LOAD_PATH.unshift(p) }