forked from RubyoffRails/Episode10
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterminator_spec.rb
50 lines (45 loc) · 1.45 KB
/
terminator_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require 'rspec'
require "./terminator"
describe Terminator do
it "should destroy_john_connor" do
subject.destroy_john_connor!
subject.current_mission.should eq("destroy: john_connor")
end
it "should protect_john_connor" do
subject.protect_john_connor!
subject.current_mission.should eq("protect: john_connor")
end
it "should destroy_sarah_connor" do
subject.destroy_sarah_connor!
subject.current_mission.should eq("destroy: sarah_connor")
end
it "should protect_sarah_connor" do
subject.protect_sarah_connor!
subject.current_mission.should eq("protect: sarah_connor")
end
describe "#protects?" do
it "should return true when protecting Sarah Connor" do
subject.protect_sarah_connor!
subject.protects?(:sarah_connor).should be_true
end
it "should return false when destroying Sarah Connor" do
subject.destroy_sarah_connor!
subject.protects?(:sarah_connor).should be_false
end
it "should protect Sarah and John Connor at the same time" do
subject.protect_sarah_connor!
subject.protect_john_connor!
subject.protects?(:sarah_connor).should be_true
end
end
describe "#good?" do
it "should return true if the terminator is good" do
subject.protect_sarah_connor!
subject.good?.should be_true
end
it "should return false if the terminator is bad" do
subject.destroy_john_connor!
subject.good?.should be_false
end
end
end