MonkeyEngine 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/MonkeyEngine.iml +133 -0
- data/.idea/codeStyleSettings.xml +13 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +5 -0
- data/.idea/modules.xml +9 -0
- data/.idea/runConfigurations/All_specs_in_test__MonkeyEngine.xml +38 -0
- data/.idea/runConfigurations/IRB_console.xml +25 -0
- data/.idea/runConfigurations/Start_Yard_Server.xml +26 -0
- data/.idea/runConfigurations/monkey_run.xml +26 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/.idea/workspace.xml +886 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +3 -0
- data/lib/Action/action.rb +29 -0
- data/lib/Monkey.rb +1 -0
- data/lib/Monkey/monkey.rb +108 -0
- data/lib/MonkeyAction/monkey_action.rb +14 -0
- data/lib/MonkeyAction/monkey_action_dead.rb +26 -0
- data/lib/MonkeyAction/monkey_action_eat.rb +31 -0
- data/lib/MonkeyAction/monkey_action_pause.rb +32 -0
- data/lib/MonkeyAction/monkey_action_sleep.rb +31 -0
- data/lib/MonkeyAction/monkey_action_type.rb +40 -0
- data/lib/MonkeyAction/monkey_action_wake.rb +26 -0
- data/lib/MonkeyAction/monkey_timed_action.rb +27 -0
- data/lib/MonkeyActions.rb +6 -0
- data/lib/MonkeyEngine.rb +1 -0
- data/lib/MonkeyEngine/action_rules.rb +111 -0
- data/lib/MonkeyEngine/exceptions.rb +21 -0
- data/lib/MonkeyEngine/monkey_engine.rb +53 -0
- data/lib/MonkeyEngine/version.rb +3 -0
- data/lib/MonkeyFactory.rb +1 -0
- data/lib/MonkeyFactory/monkey_factory.rb +14 -0
- data/lib/MonkeyKeyboard/keyboard_char.rb +10 -0
- data/lib/MonkeyKeyboard/keyboard_input.rb +14 -0
- data/lib/MonkeyKeyboard/keyboard_key.rb +26 -0
- data/lib/MonkeyKeyboard/keyboard_key_evaluator.rb +25 -0
- data/lib/MonkeyKeyboard/monkey_keyboard_en_us.rb +137 -0
- data/lib/MonkeyKeyboardEnUs.rb +1 -0
- data/lib/MonkeyManager.rb +1 -0
- data/lib/MonkeyManager/monkey_manager.rb +162 -0
- data/lib/MonkeyService.rb +1 -0
- data/lib/MonkeyService/monkey_service.rb +137 -0
- data/lib/tasks/engine.rb +91 -0
- data/monkeyengine.gemspec +32 -0
- data/spec/action_rules_spec.rb +59 -0
- data/spec/engine_spec.rb +56 -0
- data/spec/keyboard_char_spec.rb +12 -0
- data/spec/keyboard_key_spec.rb +15 -0
- data/spec/monkey_action_eat_spec.rb +86 -0
- data/spec/monkey_action_pause_spec.rb +91 -0
- data/spec/monkey_action_sleep_spec.rb +90 -0
- data/spec/monkey_action_type_spec.rb +94 -0
- data/spec/monkey_action_wake_spec.rb +58 -0
- data/spec/monkey_factory_spec.rb +23 -0
- data/spec/monkey_keyboard_en_us_spec.rb +42 -0
- data/spec/monkey_manager_spec.rb +8 -0
- data/spec/monkey_service_spec.rb +96 -0
- data/spec/monkey_spec.rb +8 -0
- data/spec/spec_helpers.rb +20 -0
- data/spec/support/shared_examples.rb +41 -0
- metadata +258 -0
data/spec/engine_spec.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require_relative 'spec_helpers'
|
2
|
+
|
3
|
+
require 'MonkeyEngine'
|
4
|
+
require 'MonkeyActions'
|
5
|
+
require 'MonkeyFactory'
|
6
|
+
|
7
|
+
|
8
|
+
describe 'Engine' do
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
@engine = MonkeyEngine::Engine.instance
|
12
|
+
@monkey = MonkeyFactory::create :groucho
|
13
|
+
@monkey.extend(SpecHelpers::SetMonkeyAction)
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'action_eval!' do
|
17
|
+
it 'should return action completed if the action is completed' do
|
18
|
+
|
19
|
+
action = MonkeyActionPause.new(@monkey, 10)
|
20
|
+
action.action_completed = false
|
21
|
+
action.action_time_of_completion = action.action_time
|
22
|
+
|
23
|
+
@monkey.set_action(action)
|
24
|
+
|
25
|
+
@engine.action_eval!(action).should == true
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should return action not completed if the action is not completed' do
|
29
|
+
|
30
|
+
action = MonkeyActionPause.new(@monkey, 60)
|
31
|
+
action.action_completed = false
|
32
|
+
|
33
|
+
@monkey.set_action(action)
|
34
|
+
|
35
|
+
@engine.action_eval!(action).should == false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'action_new' do
|
40
|
+
it 'should return a new action if a the current action is completed' do
|
41
|
+
|
42
|
+
action = MonkeyActionSleep.new(@monkey, 60*8)
|
43
|
+
action.action_completed = true
|
44
|
+
|
45
|
+
@monkey.set_action(action)
|
46
|
+
|
47
|
+
@engine.new_action(@monkey).is_a?(MonkeyActionSleep).should_not==true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'do_action' do
|
52
|
+
it 'should do something' do
|
53
|
+
skip 'todo'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'MonkeyKeyboardEnUs'
|
2
|
+
|
3
|
+
describe 'KeyboardKey' do
|
4
|
+
|
5
|
+
it 'should should return correct properties' do
|
6
|
+
|
7
|
+
keyboard_key = KeyboardKey.new 'a', 'A', :left, 1
|
8
|
+
|
9
|
+
keyboard_key.keyboard_char.should == 'a'
|
10
|
+
keyboard_key.keyboard_shift_char.should == 'A'
|
11
|
+
keyboard_key.keyboard_key_section.should == :left
|
12
|
+
keyboard_key.keyboard_key_weight.should == 1
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'Monkey'
|
2
|
+
require 'MonkeyActions'
|
3
|
+
require 'MonkeyFactory'
|
4
|
+
require 'MonkeyEngine'
|
5
|
+
|
6
|
+
require_relative 'support/shared_examples'
|
7
|
+
|
8
|
+
describe 'MonkeyActionEat' do
|
9
|
+
before(:all) do
|
10
|
+
|
11
|
+
@monkey = MonkeyFactory.create :eating_monkey1
|
12
|
+
@it = MonkeyActionEat.new @monkey, 30 # minutes
|
13
|
+
|
14
|
+
MonkeyEngine::MonkeyManager.instance.add(@monkey)
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
after(:all) do
|
19
|
+
# Kill all the threads.
|
20
|
+
MonkeyEngine::MonkeyManager.instance.kill_all!
|
21
|
+
|
22
|
+
# Give them a little bit to finish.
|
23
|
+
MonkeyEngine::MonkeyManager.instance.join_all(10)
|
24
|
+
end
|
25
|
+
|
26
|
+
it_should_behave_like 'MonkeyAction'
|
27
|
+
|
28
|
+
it '@it should be the correct type' do
|
29
|
+
@it.is_a?(MonkeyActionEat).should == true
|
30
|
+
end
|
31
|
+
|
32
|
+
# Monkey
|
33
|
+
it '@monkey should be the same monkey' do
|
34
|
+
@it.monkey.should == @monkey
|
35
|
+
end
|
36
|
+
|
37
|
+
# Value
|
38
|
+
it '@value should return the right value' do
|
39
|
+
@it.value.should == 30
|
40
|
+
end
|
41
|
+
|
42
|
+
it "@value should be is_a? Integer" do
|
43
|
+
@it.value.is_a?(Integer).should == true
|
44
|
+
end
|
45
|
+
|
46
|
+
# Weight
|
47
|
+
it '@weight should return the right weight' do
|
48
|
+
@it.weight.should == MonkeyActionEat::WEIGHT
|
49
|
+
end
|
50
|
+
|
51
|
+
# validate
|
52
|
+
it "should not raise an error if value is within acceptable range" do
|
53
|
+
monkey = MonkeyFactory.create(:eating_monkey2)
|
54
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
55
|
+
lambda { MonkeyActionEat.new(monkey, 40) }.should_not raise_error
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should raise an error if value is the wrong type" do
|
59
|
+
monkey = MonkeyFactory.create(:eating_monkey3)
|
60
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
61
|
+
lambda { MonkeyActionEat.new(monkey, :wrong_type) }.should \
|
62
|
+
raise_error MonkeyEngine::Exceptions::InvalidArgumentTypeException
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should raise an error if value is less than min acceptable range" do
|
66
|
+
monkey = MonkeyFactory.create(:eating_monkey4)
|
67
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
68
|
+
lambda { MonkeyActionEat.new(monkey, 29) }.should \
|
69
|
+
raise_error MonkeyEngine::Exceptions::InvalidArgumentValueException
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should raise an error if value is greater than max acceptable range" do
|
73
|
+
monkey = MonkeyFactory.create(:eating_monkey5)
|
74
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
75
|
+
lambda { MonkeyActionEat.new(monkey, 61) }.should \
|
76
|
+
raise_error MonkeyEngine::Exceptions::InvalidArgumentValueException
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should raise an error if value is nil" do
|
80
|
+
monkey = MonkeyFactory.create(:eating_monkey6)
|
81
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
82
|
+
lambda { MonkeyActionEat.new(monkey, nil) }.should \
|
83
|
+
raise_error MonkeyEngine::Exceptions::NilArgumentException
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'Monkey'
|
2
|
+
require 'MonkeyActions'
|
3
|
+
require 'MonkeyFactory'
|
4
|
+
require 'MonkeyEngine'
|
5
|
+
require 'MonkeyManager'
|
6
|
+
|
7
|
+
require_relative 'support/shared_examples'
|
8
|
+
|
9
|
+
describe 'MonkeyActionPause' do
|
10
|
+
before(:all) do
|
11
|
+
|
12
|
+
@monkey = MonkeyFactory.create :pausing_monkey1
|
13
|
+
@it = MonkeyActionPause.new @monkey, 1 # 1 second
|
14
|
+
|
15
|
+
MonkeyEngine::MonkeyManager.instance.add(@monkey)
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
after(:all) do
|
20
|
+
# Kill all the threads.
|
21
|
+
MonkeyEngine::MonkeyManager.instance.kill_all!
|
22
|
+
|
23
|
+
# Give them a little bit to finish.
|
24
|
+
MonkeyEngine::MonkeyManager.instance.join_all(10)
|
25
|
+
end
|
26
|
+
|
27
|
+
it_should_behave_like 'MonkeyAction'
|
28
|
+
|
29
|
+
it '@it should be the correct type' do
|
30
|
+
@it.is_a?(MonkeyActionPause).should == true
|
31
|
+
end
|
32
|
+
|
33
|
+
# Monkey
|
34
|
+
it '@monkey be the same monkey' do
|
35
|
+
@it.monkey.should == @monkey
|
36
|
+
end
|
37
|
+
|
38
|
+
# Value
|
39
|
+
it '@value should return the right value' do
|
40
|
+
@it.value.should == 1
|
41
|
+
end
|
42
|
+
|
43
|
+
it "@value should be is_a? Integer" do
|
44
|
+
@it.value.is_a?(Integer).should == true
|
45
|
+
end
|
46
|
+
|
47
|
+
it "@value should >= 1" do
|
48
|
+
(@it.value >= 1).should == true
|
49
|
+
end
|
50
|
+
|
51
|
+
# Weight
|
52
|
+
it '@weight should return the right weight' do
|
53
|
+
@it.weight.should == MonkeyActionPause::WEIGHT
|
54
|
+
end
|
55
|
+
|
56
|
+
# validate
|
57
|
+
it "should not raise an error if value is within acceptable range" do
|
58
|
+
monkey = MonkeyFactory.create(:pausing_monkey2)
|
59
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
60
|
+
lambda { MonkeyActionPause.new(monkey, 5) }.should_not raise_error
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should raise an error if value is the wrong type" do
|
64
|
+
monkey = MonkeyFactory.create(:pausing_monkey3)
|
65
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
66
|
+
lambda { MonkeyActionPause.new(monkey, :wrong_type) }.should \
|
67
|
+
raise_error MonkeyEngine::Exceptions::InvalidArgumentTypeException
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should raise an error if value is less than min acceptable range" do
|
71
|
+
monkey = MonkeyFactory.create(:pausing_monkey4)
|
72
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
73
|
+
lambda { MonkeyActionPause.new(monkey, -1) }.should \
|
74
|
+
raise_error MonkeyEngine::Exceptions::InvalidArgumentValueException
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should raise an error if value is greater than max acceptable range" do
|
78
|
+
monkey = MonkeyFactory.create(:pausing_monkey5)
|
79
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
80
|
+
lambda { MonkeyActionPause.new(monkey, 61) }.should \
|
81
|
+
raise_error MonkeyEngine::Exceptions::InvalidArgumentValueException
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should raise an error if value is nil" do
|
85
|
+
monkey = MonkeyFactory.create(:pausing_monkey6)
|
86
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
87
|
+
lambda { MonkeyActionPause.new(monkey, nil) }.should \
|
88
|
+
raise_error MonkeyEngine::Exceptions::NilArgumentException
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'Monkey'
|
2
|
+
require 'MonkeyActions'
|
3
|
+
require 'MonkeyFactory'
|
4
|
+
require 'MonkeyEngine'
|
5
|
+
|
6
|
+
require_relative 'support/shared_examples'
|
7
|
+
|
8
|
+
describe 'MonkeyActionSleep' do
|
9
|
+
before(:all) do
|
10
|
+
|
11
|
+
@monkey = MonkeyFactory.create :sleeping_monkey1
|
12
|
+
@it = MonkeyActionSleep.new @monkey, 60 * 8 # milliseconds
|
13
|
+
|
14
|
+
MonkeyEngine::MonkeyManager.instance.add(@monkey)
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
after(:all) do
|
19
|
+
# Kill all the threads.
|
20
|
+
MonkeyEngine::MonkeyManager.instance.kill_all!
|
21
|
+
|
22
|
+
# Give them a little bit to finish.
|
23
|
+
MonkeyEngine::MonkeyManager.instance.join_all(10)
|
24
|
+
end
|
25
|
+
|
26
|
+
it_should_behave_like 'MonkeyAction'
|
27
|
+
|
28
|
+
it '@it should be the correct type' do
|
29
|
+
@it.is_a?(MonkeyActionSleep).should == true
|
30
|
+
end
|
31
|
+
|
32
|
+
# Monkey
|
33
|
+
it '@monkey should be the same monkey' do
|
34
|
+
@it.monkey.should == @monkey
|
35
|
+
end
|
36
|
+
|
37
|
+
# Value
|
38
|
+
it '@value should return the right value' do
|
39
|
+
@it.value.should == 60 * 8
|
40
|
+
end
|
41
|
+
|
42
|
+
it "@value should be is_a? Integer" do
|
43
|
+
@it.value.is_a?(Integer).should == true
|
44
|
+
end
|
45
|
+
|
46
|
+
it "@value should equal 60 * 8" do
|
47
|
+
(@it.value == 60 * 8).should == true
|
48
|
+
end
|
49
|
+
|
50
|
+
# Weight
|
51
|
+
it '@weight should return the right weight' do
|
52
|
+
@it.weight.should == MonkeyActionSleep::WEIGHT
|
53
|
+
end
|
54
|
+
|
55
|
+
# validate
|
56
|
+
it "should not raise an error if value is within acceptable range" do
|
57
|
+
monkey = MonkeyFactory.create(:sleeping_monkey2)
|
58
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
59
|
+
lambda { MonkeyActionSleep.new(monkey, 60 * 8) }.should_not raise_error
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should raise an error if value is the wrong type" do
|
63
|
+
monkey = MonkeyFactory.create(:sleeping_monkey3)
|
64
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
65
|
+
lambda { MonkeyActionSleep.new(monkey, :wrong_type) }.should \
|
66
|
+
raise_error MonkeyEngine::Exceptions::InvalidArgumentTypeException
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should raise an error if value is less than min acceptable range" do
|
70
|
+
monkey = MonkeyFactory.create(:sleeping_monkey4)
|
71
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
72
|
+
lambda { MonkeyActionSleep.new(monkey, 60 * 5) }.should \
|
73
|
+
raise_error MonkeyEngine::Exceptions::InvalidArgumentValueException
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should raise an error if value is greater than max acceptable range" do
|
77
|
+
monkey = MonkeyFactory.create(:sleeping_monkey5)
|
78
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
79
|
+
lambda { MonkeyActionSleep.new(monkey, 60 * 9) }.should \
|
80
|
+
raise_error MonkeyEngine::Exceptions::InvalidArgumentValueException
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should raise an error if value is nil" do
|
84
|
+
monkey = MonkeyFactory.create(:sleeping_monkey6)
|
85
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
86
|
+
lambda { MonkeyActionSleep.new(monkey, nil) }.should \
|
87
|
+
raise_error MonkeyEngine::Exceptions::NilArgumentException
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'Monkey'
|
2
|
+
require 'MonkeyActions'
|
3
|
+
require 'MonkeyFactory'
|
4
|
+
require 'MonkeyEngine'
|
5
|
+
require_relative '../lib/MonkeyKeyboard/keyboard_input'
|
6
|
+
|
7
|
+
require_relative 'support/shared_examples'
|
8
|
+
|
9
|
+
describe 'MonkeyActionType' do
|
10
|
+
before(:all) do
|
11
|
+
|
12
|
+
@monkey = MonkeyFactory::create :typing_monkey1
|
13
|
+
|
14
|
+
keyboard_input = KeyboardInput.new
|
15
|
+
keyboard_input.input = %w{a b c d e f .}
|
16
|
+
|
17
|
+
@it = MonkeyActionType.new @monkey, keyboard_input
|
18
|
+
|
19
|
+
MonkeyEngine::MonkeyManager.instance.add(@monkey)
|
20
|
+
end
|
21
|
+
|
22
|
+
after(:all) do
|
23
|
+
# Kill all the threads.
|
24
|
+
MonkeyEngine::MonkeyManager.instance.kill_all!
|
25
|
+
|
26
|
+
# Give them a little bit to finish.
|
27
|
+
MonkeyEngine::MonkeyManager.instance.join_all(10)
|
28
|
+
end
|
29
|
+
|
30
|
+
it_should_behave_like 'MonkeyAction'
|
31
|
+
|
32
|
+
it '@it should be the correct type' do
|
33
|
+
@it.is_a?(MonkeyActionType).should == true
|
34
|
+
end
|
35
|
+
|
36
|
+
# Monkey
|
37
|
+
it '@monkey be the same monkey' do
|
38
|
+
@it.monkey.should == @monkey
|
39
|
+
end
|
40
|
+
|
41
|
+
# Value
|
42
|
+
it '@value should return the right value' do
|
43
|
+
@it.value.should == %w{a b c d e f .}
|
44
|
+
end
|
45
|
+
|
46
|
+
it "@value should be is_a? Array" do
|
47
|
+
@it.value.is_a?(Array).should == true
|
48
|
+
end
|
49
|
+
|
50
|
+
it "@value should not be nil?" do
|
51
|
+
@it.value.nil?.should_not == true
|
52
|
+
end
|
53
|
+
|
54
|
+
# Weight
|
55
|
+
it '@weight should return the right weight' do
|
56
|
+
@it.weight.should == MonkeyActionType::WEIGHT
|
57
|
+
end
|
58
|
+
|
59
|
+
# validate
|
60
|
+
it "should not raise an error if value is valid" do
|
61
|
+
monkey = MonkeyFactory::create(:typing_monkey2)
|
62
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
63
|
+
|
64
|
+
keyboard_input = KeyboardInput.new
|
65
|
+
keyboard_input.input = %w{w o r d .}
|
66
|
+
|
67
|
+
lambda { MonkeyActionType.new(monkey, keyboard_input) }.should_not raise_error
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should raise an error if value is the wrong type" do
|
71
|
+
monkey = MonkeyFactory::create(:typing_monkey3)
|
72
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
73
|
+
lambda { MonkeyActionType.new(monkey, :wrong_type) }.should \
|
74
|
+
raise_error MonkeyEngine::Exceptions::InvalidArgumentTypeException
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should raise an error if value is empty?" do
|
78
|
+
monkey = MonkeyFactory::create(:typing_monkey4)
|
79
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
80
|
+
|
81
|
+
keyboard_input = KeyboardInput.new
|
82
|
+
keyboard_input.input = %w{}
|
83
|
+
|
84
|
+
lambda { MonkeyActionType.new(monkey, keyboard_input) }.should \
|
85
|
+
raise_error MonkeyEngine::Exceptions::InvalidArgumentValueException
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should raise an error if value is nil" do
|
89
|
+
monkey = MonkeyFactory::create(:typing_monkey5)
|
90
|
+
MonkeyEngine::MonkeyManager.instance.add(monkey)
|
91
|
+
lambda { MonkeyActionType.new(monkey, nil) }.should \
|
92
|
+
raise_error MonkeyEngine::Exceptions::NilArgumentException
|
93
|
+
end
|
94
|
+
end
|