rubywarrior 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/{CHANGELOG.rdoc → CHANGELOG.md} +21 -3
  3. data/Gemfile +10 -0
  4. data/Gemfile.lock +55 -0
  5. data/LICENSE +4 -4
  6. data/{README.rdoc → README.md} +115 -93
  7. data/Rakefile +4 -9
  8. data/bin/rubywarrior +1 -1
  9. data/features/step_definitions/common_steps.rb +2 -2
  10. data/features/step_definitions/interaction_steps.rb +7 -7
  11. data/features/support/env.rb +1 -1
  12. data/lib/ruby_warrior/game.rb +5 -3
  13. data/lib/ruby_warrior/level.rb +5 -1
  14. data/lib/ruby_warrior/player_generator.rb +3 -3
  15. data/lib/ruby_warrior/profile.rb +1 -1
  16. data/lib/ruby_warrior/tower.rb +1 -1
  17. data/rubywarrior.gemspec +16 -0
  18. data/spec/ruby_warrior/abilities/attack_spec.rb +10 -10
  19. data/spec/ruby_warrior/abilities/base_spec.rb +19 -19
  20. data/spec/ruby_warrior/abilities/bind_spec.rb +5 -5
  21. data/spec/ruby_warrior/abilities/direction_of_spec.rb +3 -3
  22. data/spec/ruby_warrior/abilities/direction_of_stairs_spec.rb +3 -3
  23. data/spec/ruby_warrior/abilities/distance_of_spec.rb +3 -3
  24. data/spec/ruby_warrior/abilities/explode_spec.rb +7 -7
  25. data/spec/ruby_warrior/abilities/feel_spec.rb +1 -1
  26. data/spec/ruby_warrior/abilities/form_spec.rb +14 -14
  27. data/spec/ruby_warrior/abilities/health_spec.rb +3 -3
  28. data/spec/ruby_warrior/abilities/listen_spec.rb +3 -3
  29. data/spec/ruby_warrior/abilities/look_spec.rb +3 -3
  30. data/spec/ruby_warrior/abilities/pivot_spec.rb +1 -1
  31. data/spec/ruby_warrior/abilities/rescue_spec.rb +8 -8
  32. data/spec/ruby_warrior/abilities/rest_spec.rb +7 -7
  33. data/spec/ruby_warrior/abilities/shoot_spec.rb +4 -4
  34. data/spec/ruby_warrior/abilities/throw_spec.rb +10 -10
  35. data/spec/ruby_warrior/abilities/walk_spec.rb +5 -5
  36. data/spec/ruby_warrior/core_additions_spec.rb +2 -2
  37. data/spec/ruby_warrior/floor_spec.rb +27 -27
  38. data/spec/ruby_warrior/game_spec.rb +36 -36
  39. data/spec/ruby_warrior/level_loader_spec.rb +19 -19
  40. data/spec/ruby_warrior/level_spec.rb +57 -57
  41. data/spec/ruby_warrior/player_generator_spec.rb +3 -3
  42. data/spec/ruby_warrior/position_spec.rb +43 -43
  43. data/spec/ruby_warrior/profile_spec.rb +59 -59
  44. data/spec/ruby_warrior/space_spec.rb +71 -71
  45. data/spec/ruby_warrior/tower_spec.rb +5 -5
  46. data/spec/ruby_warrior/turn_spec.rb +13 -13
  47. data/spec/ruby_warrior/ui_spec.rb +32 -32
  48. data/spec/ruby_warrior/units/archer_spec.rb +9 -9
  49. data/spec/ruby_warrior/units/base_spec.rb +42 -42
  50. data/spec/ruby_warrior/units/captive_spec.rb +9 -9
  51. data/spec/ruby_warrior/units/golem_spec.rb +9 -9
  52. data/spec/ruby_warrior/units/sludge_spec.rb +11 -11
  53. data/spec/ruby_warrior/units/thick_sludge_spec.rb +7 -7
  54. data/spec/ruby_warrior/units/warrior_spec.rb +23 -23
  55. data/spec/ruby_warrior/units/wizard_spec.rb +9 -9
  56. data/spec/spec_helper.rb +3 -2
  57. data/towers/beginner/level_002.rb +1 -1
  58. data/towers/beginner/level_003.rb +1 -1
  59. data/towers/beginner/level_005.rb +2 -2
  60. data/towers/beginner/level_006.rb +2 -2
  61. data/towers/intermediate/level_002.rb +1 -1
  62. data/towers/intermediate/level_003.rb +2 -2
  63. metadata +47 -67
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe RubyWarrior::Position do
4
4
  before(:each) do
@@ -9,100 +9,100 @@ describe RubyWarrior::Position do
9
9
  @floor.add(@unit, 1, 2, :north)
10
10
  @position = @unit.position
11
11
  end
12
-
12
+
13
13
  it "should rotate clockwise" do
14
- @position.direction.should == :north
14
+ expect(@position.direction).to eq(:north)
15
15
  [:east, :south, :west, :north, :east].each do |dir|
16
16
  @position.rotate(1)
17
- @position.direction.should == dir
17
+ expect(@position.direction).to eq(dir)
18
18
  end
19
19
  end
20
-
20
+
21
21
  it "should rotate counterclockwise" do
22
- @position.direction.should == :north
22
+ expect(@position.direction).to eq(:north)
23
23
  [:west, :south, :east, :north, :west].each do |dir|
24
24
  @position.rotate(-1)
25
- @position.direction.should == dir
25
+ expect(@position.direction).to eq(dir)
26
26
  end
27
27
  end
28
-
28
+
29
29
  it "should get relative space in front" do
30
30
  unit = RubyWarrior::Units::Base.new
31
31
  @floor.add(unit, 1, 1)
32
- @position.relative_space(1).should_not be_empty
32
+ expect(@position.relative_space(1)).to_not be_empty
33
33
  end
34
-
34
+
35
35
  it "should get relative object in front when rotated" do
36
36
  unit = RubyWarrior::Units::Base.new
37
37
  @floor.add(unit, 2, 2)
38
38
  @position.rotate(1)
39
- @position.relative_space(1).should_not be_empty
39
+ expect(@position.relative_space(1)).to_not be_empty
40
40
  end
41
-
41
+
42
42
  it "should get relative object diagonally" do
43
43
  unit = RubyWarrior::Units::Base.new
44
44
  @floor.add(unit, 0, 1)
45
- @position.relative_space(1, -1).should_not be_empty
45
+ expect(@position.relative_space(1, -1)).to_not be_empty
46
46
  end
47
-
47
+
48
48
  it "should get relative object diagonally when rotating" do
49
49
  unit = RubyWarrior::Units::Base.new
50
50
  @floor.add(unit, 0, 1)
51
51
  @position.rotate(2)
52
- @position.relative_space(-1, 1).should_not be_empty
52
+ expect(@position.relative_space(-1, 1)).to_not be_empty
53
53
  end
54
-
54
+
55
55
  it "should move object on floor relatively" do
56
- @floor.get(1, 2).should == @unit
56
+ expect(@floor.get(1, 2)).to eq(@unit)
57
57
  @position.move(-1, 2)
58
- @floor.get(1, 2).should be_nil
59
- @floor.get(3, 3).should == @unit
58
+ expect(@floor.get(1, 2)).to be_nil
59
+ expect(@floor.get(3, 3)).to eq(@unit)
60
60
  @position.rotate(1)
61
61
  @position.move(-1)
62
- @floor.get(3, 3).should be_nil
63
- @floor.get(2, 3).should == @unit
62
+ expect(@floor.get(3, 3)).to be_nil
63
+ expect(@floor.get(2, 3)).to eq(@unit)
64
64
  end
65
-
65
+
66
66
  it "should return distance from stairs as 0 when on stairs" do
67
67
  @floor.place_stairs(1, 2)
68
- @position.distance_from_stairs.should == 0
68
+ expect(@position.distance_from_stairs).to eq(0)
69
69
  end
70
-
70
+
71
71
  it "should return distance from stairs in both directions" do
72
72
  @floor.place_stairs(0, 3)
73
- @position.distance_from_stairs.should == 2
73
+ expect(@position.distance_from_stairs).to eq(2)
74
74
  end
75
-
75
+
76
76
  it "should return relative direction of stairs" do
77
77
  @floor.place_stairs(0, 0)
78
- @position.relative_direction_of_stairs.should == :forward
78
+ expect(@position.relative_direction_of_stairs).to eq(:forward)
79
79
  end
80
-
80
+
81
81
  it "should return relative direction of given space" do
82
- @position.relative_direction_of(@floor.space(5, 3)).should == :right
82
+ expect(@position.relative_direction_of(@floor.space(5, 3))).to eq(:right)
83
83
  @position.rotate 1
84
- @position.relative_direction_of(@floor.space(1, 4)).should == :right
84
+ expect(@position.relative_direction_of(@floor.space(1, 4))).to eq(:right)
85
85
  end
86
-
86
+
87
87
  it "should be able to determine relative direction" do
88
- @position.relative_direction(:north).should == :forward
89
- @position.relative_direction(:south).should == :backward
90
- @position.relative_direction(:west).should == :left
91
- @position.relative_direction(:east).should == :right
88
+ expect(@position.relative_direction(:north)).to eq(:forward)
89
+ expect(@position.relative_direction(:south)).to eq(:backward)
90
+ expect(@position.relative_direction(:west)).to eq(:left)
91
+ expect(@position.relative_direction(:east)).to eq(:right)
92
92
  @position.rotate 1
93
- @position.relative_direction(:north).should == :left
93
+ expect(@position.relative_direction(:north)).to eq(:left)
94
94
  @position.rotate 1
95
- @position.relative_direction(:north).should == :backward
95
+ expect(@position.relative_direction(:north)).to eq(:backward)
96
96
  @position.rotate 1
97
- @position.relative_direction(:north).should == :right
97
+ expect(@position.relative_direction(:north)).to eq(:right)
98
98
  end
99
-
99
+
100
100
  it "should return a space at the same location as position" do
101
- @position.space.location.should == [1, 2]
101
+ expect(@position.space.location).to eq([1, 2])
102
102
  end
103
-
103
+
104
104
  it "should return distance of given space" do
105
- @position.distance_of(@floor.space(5, 3)).should == 5
106
- @position.distance_of(@floor.space(4, 2)).should == 3
105
+ expect(@position.distance_of(@floor.space(5, 3))).to eq(5)
106
+ expect(@position.distance_of(@floor.space(4, 2))).to eq(3)
107
107
  end
108
108
  end
@@ -1,83 +1,83 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe RubyWarrior::Profile do
4
4
  before(:each) do
5
5
  @profile = RubyWarrior::Profile.new
6
6
  end
7
-
7
+
8
8
  it "should have warrior name" do
9
9
  @profile.warrior_name = 'Joe'
10
- @profile.warrior_name.should == 'Joe'
10
+ expect(@profile.warrior_name).to eq('Joe')
11
11
  end
12
-
12
+
13
13
  it "should start level number at 0" do
14
- @profile.level_number.should be_zero
14
+ expect(@profile.level_number).to be_zero
15
15
  end
16
-
16
+
17
17
  it "should start score at 0 and allow it to increment" do
18
- @profile.score.should be_zero
18
+ expect(@profile.score).to be_zero
19
19
  @profile.score += 5
20
- @profile.score.should == 5
20
+ expect(@profile.score).to eq(5)
21
21
  end
22
-
22
+
23
23
  it "should have no abilities and allow adding" do
24
- @profile.abilities.should == []
24
+ expect(@profile.abilities).to eq([])
25
25
  @profile.abilities += [:foo, :bar]
26
- @profile.abilities.should == [:foo, :bar]
26
+ expect(@profile.abilities).to eq([:foo, :bar])
27
27
  end
28
-
28
+
29
29
  it "should encode with marshal + base64" do
30
- @profile.encode.should == Base64.encode64(Marshal.dump(@profile))
30
+ expect(@profile.encode).to eq(Base64.encode64(Marshal.dump(@profile)))
31
31
  end
32
-
32
+
33
33
  it "should decode with marshal + base64" do
34
- RubyWarrior::Profile.decode(@profile.encode).warrior_name.should == @profile.warrior_name
34
+ expect(RubyWarrior::Profile.decode(@profile.encode).warrior_name).to eq(@profile.warrior_name)
35
35
  end
36
-
36
+
37
37
  it "load should read file, decode and set player path" do
38
38
  profile = 'profile'
39
39
  profile.expects(:player_path=).with('path/to')
40
40
  File.expects(:read).with('path/to/.profile').returns('encoded_profile')
41
41
  RubyWarrior::Profile.expects(:decode).with('encoded_profile').returns(profile)
42
- RubyWarrior::Profile.load('path/to/.profile').should == profile
42
+ expect(RubyWarrior::Profile.load('path/to/.profile')).to eq(profile)
43
43
  end
44
44
 
45
-
45
+
46
46
  it "should add abilities and remove duplicates" do
47
47
  @profile.add_abilities(:foo, :bar, :blah, :bar)
48
- @profile.abilities.should == [:foo, :bar, :blah]
48
+ expect(@profile.abilities).to eq([:foo, :bar, :blah])
49
49
  end
50
-
50
+
51
51
  it "should fetch new level with current number" do
52
52
  @profile.level_number = 1
53
- @profile.current_level.number.should == 1
53
+ expect(@profile.current_level.number).to eq(1)
54
54
  end
55
55
 
56
56
  it "should fetch next level" do
57
57
  @profile.level_number = 1
58
- @profile.next_level.number.should == 2
58
+ expect(@profile.next_level.number).to eq(2)
59
59
  end
60
60
 
61
61
  it "should enable epic mode and reset scores if nil" do
62
62
  @profile.epic_score = nil
63
63
  @profile.current_epic_score = nil
64
64
  @profile.enable_epic_mode
65
- @profile.should be_epic
66
- @profile.epic_score.should be_zero
67
- @profile.current_epic_score.should be_zero
65
+ expect(@profile).to be_epic
66
+ expect(@profile.epic_score).to be_zero
67
+ expect(@profile.current_epic_score).to be_zero
68
68
  end
69
-
69
+
70
70
  it "should override epic score with current one if it is higher" do
71
71
  @profile.enable_epic_mode
72
- @profile.epic_score.should be_zero
73
- @profile.average_grade.should be_nil
72
+ expect(@profile.epic_score).to be_zero
73
+ expect(@profile.average_grade).to be_nil
74
74
  @profile.current_epic_score = 123
75
75
  @profile.current_epic_grades = { 1 => 0.7, 2 => 0.9 }
76
76
  @profile.update_epic_score
77
- @profile.epic_score.should == 123
78
- @profile.average_grade.should == 0.8
77
+ expect(@profile.epic_score).to eq(123)
78
+ expect(@profile.average_grade).to eq(0.8)
79
79
  end
80
-
80
+
81
81
  it "should not override epic score with current one if it is lower" do
82
82
  @profile.enable_epic_mode
83
83
  @profile.epic_score = 124
@@ -85,20 +85,20 @@ describe RubyWarrior::Profile do
85
85
  @profile.current_epic_score = 123
86
86
  @profile.current_epic_grades = { 1 => 0.7, 2 => 0.9 }
87
87
  @profile.update_epic_score
88
- @profile.epic_score.should == 124
89
- @profile.average_grade.should == 0.9
88
+ expect(@profile.epic_score).to eq(124)
89
+ expect(@profile.average_grade).to eq(0.9)
90
90
  end
91
-
91
+
92
92
  it "should not calculate average grade if no grades are present" do
93
93
  @profile.enable_epic_mode
94
94
  @profile.current_epic_grades = {}
95
- @profile.calculate_average_grade.should be_nil
95
+ expect(@profile.calculate_average_grade).to be_nil
96
96
  end
97
97
 
98
98
  it "should remember current level number as last_level_number" do
99
99
  @profile.level_number = 7
100
100
  @profile.enable_epic_mode
101
- @profile.last_level_number.should == 7
101
+ expect(@profile.last_level_number).to eq(7)
102
102
  end
103
103
 
104
104
  it "should enable normal mode by clearing epic scores and resetting last level number" do
@@ -108,26 +108,26 @@ describe RubyWarrior::Profile do
108
108
  @profile.current_epic_grades = { 1 => 100 }
109
109
  @profile.average_grade = "C"
110
110
  @profile.enable_normal_mode
111
- @profile.should_not be_epic
112
- @profile.epic_score.should be_zero
113
- @profile.current_epic_score.should be_zero
114
- @profile.last_level_number.should be_nil
115
- @profile.average_grade.should be_nil
116
- @profile.current_epic_grades.should == {}
117
- @profile.level_number.should == 7
111
+ expect(@profile).to_not be_epic
112
+ expect(@profile.epic_score).to be_zero
113
+ expect(@profile.current_epic_score).to be_zero
114
+ expect(@profile.last_level_number).to be_nil
115
+ expect(@profile.average_grade).to be_nil
116
+ expect(@profile.current_epic_grades).to eq({})
117
+ expect(@profile.level_number).to eq(7)
118
118
  end
119
119
 
120
120
  it "should be no level after epic if last level isn't specified" do
121
121
  @profile.last_level_number = nil
122
- @profile.should_not be_level_after_epic
122
+ expect(@profile).to_not be_level_after_epic
123
123
  end
124
-
124
+
125
125
  describe "with tower path" do
126
126
  before(:each) do
127
127
  @profile.warrior_name = "John Smith"
128
128
  @profile.tower_path = 'path/to/tower'
129
129
  end
130
-
130
+
131
131
  it "save should write file with encoded profile" do
132
132
  file = stub
133
133
  file.expects(:write).with('encoded_profile')
@@ -135,37 +135,37 @@ describe RubyWarrior::Profile do
135
135
  @profile.expects(:encode).returns('encoded_profile')
136
136
  @profile.save
137
137
  end
138
-
138
+
139
139
  it "should have a nice string representation" do
140
140
  @profile.warrior_name = 'Joe'
141
- @profile.to_s.should == "Joe - tower - level 0 - score 0"
141
+ expect(@profile.to_s).to eq("Joe - tower - level 0 - score 0")
142
142
  end
143
-
143
+
144
144
  it "should include epic score in string representation" do
145
145
  @profile.warrior_name = 'Joe'
146
146
  @profile.enable_epic_mode
147
- @profile.to_s.should == "Joe - tower - first score 0 - epic score 0"
147
+ expect(@profile.to_s).to eq("Joe - tower - first score 0 - epic score 0")
148
148
  end
149
-
149
+
150
150
  it "should include epic score with grade in string representation" do
151
151
  @profile.warrior_name = 'Joe'
152
152
  @profile.enable_epic_mode
153
153
  @profile.average_grade = 0.7
154
- @profile.to_s.should == "Joe - tower - first score 0 - epic score 0 (C)"
154
+ expect(@profile.to_s).to eq("Joe - tower - first score 0 - epic score 0 (C)")
155
155
  end
156
-
156
+
157
157
  it "should guess at the player path" do
158
- @profile.player_path.should == './rubywarrior/john-smith-tower'
158
+ expect(@profile.player_path).to eq('./rubywarrior/john-smith-tower')
159
159
  end
160
-
160
+
161
161
  it "should use specified player path" do
162
162
  @profile.player_path = "path/to/player"
163
- @profile.player_path.should == "path/to/player"
163
+ expect(@profile.player_path).to eq("path/to/player")
164
164
  end
165
-
165
+
166
166
  it "should load tower from path" do
167
- RubyWarrior::Tower.expects(:new).with('path/to/tower').returns('tower')
168
- @profile.tower.should == 'tower'
167
+ RubyWarrior::Tower.expects(:new).with('tower').returns('tower')
168
+ expect(@profile.tower).to eq('tower')
169
169
  end
170
170
  end
171
171
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe RubyWarrior::Space do
4
4
  before(:each) do
@@ -6,185 +6,185 @@ describe RubyWarrior::Space do
6
6
  @floor.width = 2
7
7
  @floor.height = 3
8
8
  end
9
-
9
+
10
10
  describe "with empty space" do
11
11
  before(:each) do
12
12
  @space = @floor.space(0, 0)
13
13
  end
14
-
14
+
15
15
  it "should not be enemy" do
16
- @space.should_not be_enemy
16
+ expect(@space).to_not be_enemy
17
17
  end
18
-
18
+
19
19
  it "should not be warrior" do
20
- @space.should_not be_warrior
20
+ expect(@space).to_not be_warrior
21
21
  end
22
-
22
+
23
23
  it "should be empty" do
24
- @space.should be_empty
24
+ expect(@space).to be_empty
25
25
  end
26
-
26
+
27
27
  it "should not be wall" do
28
- @space.should_not be_wall
28
+ expect(@space).to_not be_wall
29
29
  end
30
-
30
+
31
31
  it "should not be stairs" do
32
- @space.should_not be_stairs
32
+ expect(@space).to_not be_stairs
33
33
  end
34
-
34
+
35
35
  it "should not be captive" do
36
- @space.should_not be_captive
36
+ expect(@space).to_not be_captive
37
37
  end
38
-
38
+
39
39
  it "should say 'nothing' as name" do
40
- @space.to_s.should == 'nothing'
40
+ expect(@space.to_s).to eq('nothing')
41
41
  end
42
-
42
+
43
43
  it "should not be ticking" do
44
- @space.should_not be_ticking
44
+ expect(@space).to_not be_ticking
45
45
  end
46
46
  end
47
-
47
+
48
48
  describe "out of bounds" do
49
49
  before(:each) do
50
50
  @space = @floor.space(-1, 1)
51
51
  end
52
-
52
+
53
53
  it "should be wall" do
54
- @space.should be_wall
54
+ expect(@space).to be_wall
55
55
  end
56
-
56
+
57
57
  it "should not be empty" do
58
- @space.should_not be_empty
58
+ expect(@space).to_not be_empty
59
59
  end
60
-
60
+
61
61
  it "should have name of 'wall'" do
62
- @space.to_s.should == 'wall'
62
+ expect(@space.to_s).to eq('wall')
63
63
  end
64
64
  end
65
-
65
+
66
66
  describe "with warrior" do
67
67
  before(:each) do
68
68
  warrior = RubyWarrior::Units::Warrior.new
69
69
  @floor.add(warrior, 0, 0)
70
70
  @space = @floor.space(0, 0)
71
71
  end
72
-
72
+
73
73
  it "should be warrior" do
74
- @space.should be_warrior
74
+ expect(@space).to be_warrior
75
75
  end
76
-
76
+
77
77
  it "should be player" do
78
- @space.should be_warrior
78
+ expect(@space).to be_warrior
79
79
  end
80
-
80
+
81
81
  it "should not be enemy" do
82
- @space.should_not be_enemy
82
+ expect(@space).to_not be_enemy
83
83
  end
84
-
84
+
85
85
  it "should not be empty" do
86
- @space.should_not be_enemy
86
+ expect(@space).to_not be_enemy
87
87
  end
88
-
88
+
89
89
  it "should know what unit is on that space" do
90
- @space.unit.should be_kind_of(RubyWarrior::Units::Warrior)
90
+ expect(@space.unit).to be_kind_of(RubyWarrior::Units::Warrior)
91
91
  end
92
92
  end
93
-
93
+
94
94
  describe "with enemy" do
95
95
  before(:each) do
96
96
  @floor.add(RubyWarrior::Units::Sludge.new, 0, 0)
97
97
  @space = @floor.space(0, 0)
98
98
  end
99
-
99
+
100
100
  it "should be enemy" do
101
- @space.should be_enemy
101
+ expect(@space).to be_enemy
102
102
  end
103
-
103
+
104
104
  it "should not be warrior" do
105
- @space.should_not be_warrior
105
+ expect(@space).to_not be_warrior
106
106
  end
107
-
107
+
108
108
  it "should not be empty" do
109
- @space.should_not be_empty
109
+ expect(@space).to_not be_empty
110
110
  end
111
-
111
+
112
112
  it "should have name of unit" do
113
- @space.to_s.should == "Sludge"
113
+ expect(@space.to_s).to eq("Sludge")
114
114
  end
115
-
115
+
116
116
  describe "bound" do
117
117
  before(:each) do
118
118
  @space.unit.bind
119
119
  end
120
-
120
+
121
121
  it "should be captive" do
122
- @space.should be_captive
122
+ expect(@space).to be_captive
123
123
  end
124
-
124
+
125
125
  it "should not look like enemy" do
126
- @space.should_not be_enemy
126
+ expect(@space).to_not be_enemy
127
127
  end
128
128
  end
129
129
  end
130
-
130
+
131
131
  describe "with captive" do
132
132
  before(:each) do
133
133
  @captive = RubyWarrior::Units::Captive.new
134
134
  @floor.add(@captive, 0, 0)
135
135
  @space = @floor.space(0, 0)
136
136
  end
137
-
137
+
138
138
  it "should be captive" do
139
- @space.should be_captive
139
+ expect(@space).to be_captive
140
140
  end
141
-
141
+
142
142
  it "should not be enemy" do
143
- @space.should_not be_enemy
143
+ expect(@space).to_not be_enemy
144
144
  end
145
-
145
+
146
146
  it "should be ticking if captive has time bomb" do
147
147
  @captive.add_abilities :explode!
148
- @space.should be_ticking
148
+ expect(@space).to be_ticking
149
149
  end
150
-
150
+
151
151
  it "should not be ticking if captive does not have time bomb" do
152
- @space.should_not be_ticking
152
+ expect(@space).to_not be_ticking
153
153
  end
154
154
  end
155
-
155
+
156
156
  describe "with golem" do
157
157
  before(:each) do
158
158
  @golem = RubyWarrior::Units::Golem.new
159
159
  @floor.add(@golem, 0, 0)
160
160
  @space = @floor.space(0, 0)
161
161
  end
162
-
162
+
163
163
  it "should be golem" do
164
- @space.should be_golem
164
+ expect(@space).to be_golem
165
165
  end
166
-
166
+
167
167
  it "should not be enemy" do
168
- @space.should_not be_enemy
168
+ expect(@space).to_not be_enemy
169
169
  end
170
-
170
+
171
171
  it "should be player" do
172
- @space.should be_player
172
+ expect(@space).to be_player
173
173
  end
174
174
  end
175
-
175
+
176
176
  describe "at stairs" do
177
177
  before(:each) do
178
178
  @floor.place_stairs(0, 0)
179
179
  @space = @floor.space(0, 0)
180
180
  end
181
-
181
+
182
182
  it "should be empty" do
183
- @space.should be_empty
183
+ expect(@space).to be_empty
184
184
  end
185
-
185
+
186
186
  it "should be stairs" do
187
- @space.should be_stairs
187
+ expect(@space).to be_stairs
188
188
  end
189
189
  end
190
190
  end
@@ -1,15 +1,15 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe RubyWarrior::Tower do
4
4
  before(:each) do
5
5
  @tower = RubyWarrior::Tower.new('path/to/tower')
6
6
  end
7
-
7
+
8
8
  it "should consider last part of path as name" do
9
- @tower.name.should == 'tower'
9
+ expect(@tower.name).to eq('tower')
10
10
  end
11
-
11
+
12
12
  it "should use name when converting to string" do
13
- @tower.to_s.should == @tower.name
13
+ expect(@tower.to_s).to eq(@tower.name)
14
14
  end
15
15
  end