spec/shenandoah/locator_spec.rb in rsutphin-shenandoah-0.1.0 vs spec/shenandoah/locator_spec.rb in rsutphin-shenandoah-0.1.1
- old
+ new
@@ -9,38 +9,48 @@
before do
ENV['TMPDIR'] = nil
@loc = Shenandoah::DefaultLocator.new
end
- it "has main_path = lib" do
- @loc.main_path.should == "lib"
+ it "has main_path = `pwd`/lib" do
+ @loc.main_path.should == File.join(FileUtils.pwd, "lib")
end
- it "has spec_path = spec" do
- @loc.spec_path.should == "spec"
+ it "has spec_path = `pwd`/spec" do
+ @loc.spec_path.should == File.join(FileUtils.pwd, "spec")
end
it "uses the TMPDIR env var for tmp" do
ENV['TMPDIR'] = "/var/tmp"
Shenandoah::DefaultLocator.new.tmp_path.should == "/var/tmp"
end
it "has tmp_path = tmp" do
- @loc.tmp_path.should == "tmp"
+ @loc.tmp_path.should == File.join(FileUtils.pwd, "tmp")
end
end
describe "initializing from options" do
it "uses an explicit main path" do
- Shenandoah::DefaultLocator.new(:main_path => 'main').main_path.should == 'main'
+ Shenandoah::DefaultLocator.new(:main_path => '/main').main_path.should == '/main'
end
it "uses an explicit spec path" do
- Shenandoah::DefaultLocator.new(:spec_path => 'foo').spec_path.should == 'foo'
+ Shenandoah::DefaultLocator.new(:spec_path => '/foo').spec_path.should == '/foo'
end
it "uses an explicit tmp path" do
- Shenandoah::DefaultLocator.new(:tmp_path => 'foo').tmp_path.should == 'foo'
+ Shenandoah::DefaultLocator.new(:tmp_path => '/foo/tmp').tmp_path.should == '/foo/tmp'
+ end
+
+ describe "with relative paths" do
+ %w(main_path spec_path tmp_path).each do |kind|
+ k = kind.to_sym
+ it "absolutizes #{kind} against the working directory" do
+ Shenandoah::DefaultLocator.new(k => 'bar').send(k).should ==
+ File.join(FileUtils.pwd, 'bar')
+ end
+ end
end
end
describe "finding specs" do
before do