Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixing specs for relative tower path behavior

  • Loading branch information...
commit 5e716ecd5a2b25ff9cb9819bd589556aa46a2e99 1 parent c80d4e2
Ryan Bates authored
2  lib/ruby_warrior/game.rb
View
@@ -156,7 +156,7 @@ def towers
end
def tower_paths
- Dir[File.expand_path(File.dirname(__FILE__) + '/../../towers/*')]
+ Dir[File.expand_path('../../../towers/*', __FILE__)]
end
2  lib/ruby_warrior/level.rb
View
@@ -25,7 +25,7 @@ def player_path
def load_path
File.join(
- File.expand_path(File.dirname(__FILE__) + '/../../towers/'),
+ File.expand_path('../../../towers/', __FILE__),
File.basename(@profile.tower_path) + "/level_" +
@number.to_s.rjust(3, '0') + ".rb"
)
2  lib/ruby_warrior/player_generator.rb
View
@@ -29,7 +29,7 @@ def generate
end
def templates_path
- File.expand_path(File.dirname(__FILE__) + "/../../templates")
+ File.expand_path("../../../templates", __FILE__)
end
private
2  lib/ruby_warrior/tower.rb
View
@@ -3,7 +3,7 @@ class Tower
attr_reader :path
def initialize(path)
- @path = File.join(File.expand_path(File.dirname(__FILE__) + '/../../towers/'), path)
+ @path = File.join(File.expand_path('../../../towers/', __FILE__), path)
end
def name
2  spec/ruby_warrior/game_spec.rb
View
@@ -74,7 +74,7 @@
end
it "should find tower paths using Dir[] search" do
- Dir.expects(:[]).with(File.expand_path(File.dirname(__FILE__) + '/../../towers/*'))
+ Dir.expects(:[]).with(File.expand_path('../../../towers/*', __FILE__))
@game.tower_paths
end
2  spec/ruby_warrior/level_spec.rb
View
@@ -51,7 +51,7 @@
it "should have a load path from profile tower with level number in it" do
@profile.stubs(:tower_path).returns('path/to/tower')
- @level.load_path.should == 'path/to/tower/level_001.rb'
+ @level.load_path.should == File.expand_path('towers/tower/level_001.rb')
end
it "should exist if file exists" do
2  spec/ruby_warrior/player_generator_spec.rb
View
@@ -7,6 +7,6 @@
end
it "should know templates path" do
- @generator.templates_path.should == File.expand_path(File.dirname(__FILE__) + "/../../templates")
+ @generator.templates_path.should == File.expand_path("../../../templates", __FILE__)
end
end
2  spec/ruby_warrior/profile_spec.rb
View
@@ -164,7 +164,7 @@
end
it "should load tower from path" do
- RubyWarrior::Tower.expects(:new).with('path/to/tower').returns('tower')
+ RubyWarrior::Tower.expects(:new).with('tower').returns('tower')
@profile.tower.should == 'tower'
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.