Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

renaming level builder to level loader

  • Loading branch information...
commit 64e1ef885c3e63e0bbb093308c07a82c033d33eb 1 parent c0559fa
@ryanb authored
View
2  lib/ruby_warrior.rb
@@ -4,7 +4,7 @@
require 'ruby_warrior/profile'
require 'ruby_warrior/ui'
require 'ruby_warrior/player_generator'
-require 'ruby_warrior/level_builder'
+require 'ruby_warrior/level_loader'
require 'ruby_warrior/tower'
require 'ruby_warrior/level'
require 'ruby_warrior/turn'
View
2  lib/ruby_warrior/level.rb
@@ -10,7 +10,7 @@ def initialize(profile, number)
end
def load_level(level_path)
- loader = LevelBuilder.new(self)
+ loader = LevelLoader.new(self)
loader.instance_eval(File.read(level_path))
end
View
2  lib/ruby_warrior/level_builder.rb → lib/ruby_warrior/level_loader.rb
@@ -1,5 +1,5 @@
module RubyWarrior
- class LevelBuilder
+ class LevelLoader
def initialize(level)
@level = level
end
View
2  lib/ruby_warrior/tower.rb
@@ -19,7 +19,7 @@ def file_for_level(number)
end
def build_level(number, profile)
- LevelBuilder.build(level_paths[number-1], profile)
+ LevelLoader.build(level_paths[number-1], profile)
end
end
end
View
18 spec/ruby_warrior/level_builder_spec.rb → spec/ruby_warrior/level_loader_spec.rb
@@ -1,34 +1,34 @@
require File.dirname(__FILE__) + '/../spec_helper'
-describe RubyWarrior::LevelBuilder do
+describe RubyWarrior::LevelLoader do
describe "with profile" do
before(:each) do
@profile = RubyWarrior::Profile.new
@level = RubyWarrior::Level.new(@profile, 1)
- @builder = RubyWarrior::LevelBuilder.new(@level)
+ @loader = RubyWarrior::LevelLoader.new(@level)
end
-
+
it "should be able to add description and tip" do
- @builder.description "foo"
- @builder.tip "bar"
+ @loader.description "foo"
+ @loader.tip "bar"
@level.description.should == "foo"
@level.tip.should == "bar"
end
-
+
it "should be able to add stairs" do
@level.expects(:place_stairs).with(1, 2)
- @builder.stairs 1, 2
+ @loader.stairs 1, 2
end
it "should yield new unit when building" do
- @builder.unit :base, 1, 2 do |unit|
+ @loader.unit :base, 1, 2 do |unit|
unit.should be_kind_of(RubyWarrior::Units::Base)
unit.position.should be_at(1, 2)
end
end
it "should build warrior from profile" do
- @builder.warrior 1, 2 do |unit|
+ @loader.warrior 1, 2 do |unit|
unit.should be_kind_of(RubyWarrior::Units::Warrior)
unit.position.should be_at(1, 2)
end
View
6 spec/ruby_warrior/tower_spec.rb
@@ -16,7 +16,7 @@
it "should build specified level" do
@tower.stubs(:level_paths).returns(['foo', 'bar', 'blah'])
- RubyWarrior::LevelBuilder.expects(:build).with('bar', 'profile')
+ RubyWarrior::LevelLoader.expects(:build).with('bar', 'profile')
@tower.build_level(2, 'profile')
end
@@ -35,9 +35,9 @@
# @tower.path
# end
#
- # it "call LevelBuilder.build for building file" do
+ # it "call LevelLoader.build for building file" do
# @tower.stubs(:level_files).returns(['foo', 'bar', 'blah'])
- # RubyWarrior::LevelBuilder.expects(:build).with('bar')
+ # RubyWarrior::LevelLoader.expects(:build).with('bar')
# @tower.build_level(2)
# end
end
Please sign in to comment.
Something went wrong with that request. Please try again.