-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathterminator_spec.rb
More file actions
58 lines (47 loc) · 1.44 KB
/
Copy pathterminator_spec.rb
File metadata and controls
58 lines (47 loc) · 1.44 KB
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
51
52
53
54
55
56
57
58
require 'rspec'
require "./terminator"
describe GoodTerminator do
it 'should protect_john_connor' do
subject.protect_john_connor!
subject.current_mission.should == 'protect: john_connor'
end
it 'should protect_sarah_connor' do
subject.protect_sarah_connor!
subject.current_mission.should == 'protect: sarah_connor'
end
describe '#protects?' do
it 'should return true for john connor' do
subject.protects?(:john_connor).should be_true
end
it 'should return true for sarah connor' do
subject.protects?(:sarah_connor).should be_true
end
it 'should return false for random unknown person' do
subject.protects?(:random_person).should be_false
end
end
it 'should say terminator good if protecting someone' do
subject.protect_john_connor!
subject.should be_good
end
end
describe BadTerminator do
it 'should destroy_john_connor' do
subject.destroy_john_connor!
subject.current_mission.should == 'destroy: john_connor'
end
it 'should destroy_sarah_connor' do
subject.destroy_sarah_connor!
subject.current_mission.should == 'destroy: sarah_connor'
end
it 'should tell us terminator is bad if destroying someone' do
subject.destroy_john_connor!
subject.should_not be_good
end
describe '#protects?' do
it 'should not protect john_connor' do
subject.destroy_john_connor!
subject.protects?(:john_connor).should be_false
end
end
end