diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index e2f4f80..95301ed 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -1 +1,10 @@ require "spec" +require "../src/game/**" +require "../src/cli/**" + +def create_map_2x2 : Game::Map + map = Game::Map.new 2, 2 + map.set(Game::MainBaseTile.new(Game::Point.new(0, 0))) + map.set(Game::CrystalTile.new(Game::Point.new(1, 1), 100)) + map +end diff --git a/spec/world_spec.cr b/spec/world_spec.cr index 74bc0a1..5fdbf2f 100644 --- a/spec/world_spec.cr +++ b/spec/world_spec.cr @@ -1,11 +1,9 @@ require "./spec_helper" -require "../src/game/world" describe "World" do it "should build crystal harvester" do - map = Game::Generator.make 5, 5 - world = Game::World.new map - point = Game::Point.new 2, 3 + world = Game::World.new create_map_2x2 + point = Game::Point.new 1, 0 cmd = Game::BuildCrystalHarvesterCommand.new(point) world.push(cmd) world.run(100) @@ -13,9 +11,8 @@ describe "World" do end it "should fail when not enought resources" do - map = Game::Generator.make 5, 5 - world = Game::World.new map - point = Game::Point.new 2, 3 + world = Game::World.new create_map_2x2 + point = Game::Point.new 1, 0 cmd = Game::BuildCrystalRestorerCommand.new(point) expect_raises(Game::NotEnoughtResources) do world.push(cmd)