-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added integration test of drawer in features as an example
- Loading branch information
1 parent
58349e5
commit 353aa64
Showing
9 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'command_processor' | ||
require 'test/unit/assertions' | ||
include Test::Unit::Assertions | ||
Given /^a machine$/ do | ||
@machine = CommandProcessor.client | ||
end | ||
|
||
When /^drawer (\d+) drops a can$/ do |arg1| | ||
@machine.clear_bin_events | ||
@machine.drop_can_from_drawer(arg1.to_i) | ||
end | ||
|
||
Then /^it is received by the bin$/ do | ||
sleep(3) | ||
assert @machine.bin_has_received_something | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'drb' | ||
module CommandProcessor | ||
URI = "druby://localhost:14567" | ||
|
||
def self.run_server(commands) | ||
DRb.start_service(URI,commands) | ||
end | ||
|
||
def self.client | ||
DRbObject.new(nil, URI) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'devices' | ||
require 'device_wrappers' | ||
module Control | ||
|
||
class RemoteCommands | ||
include VMLog | ||
def test | ||
log "works" | ||
end | ||
|
||
def clear_bin_events | ||
@bin = PhyscalBin.new | ||
end | ||
|
||
def drop_can_from_drawer(drawer) | ||
PhysicalDrawer.new(drawer).drop_can | ||
end | ||
|
||
def bin_has_received_something | ||
!@bin.empty? | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'device_wrappers/bin' | ||
require 'device_wrappers/drawer' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class PhyscalBin | ||
def initialize | ||
@events_received = 0 | ||
Devices.on_bin_entry do | ||
@events_received += 1 | ||
end | ||
end | ||
def empty? | ||
@events_received == 0 | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class PhysicalDrawer | ||
def initialize(drawer_no) | ||
@drawer_no = drawer_no | ||
end | ||
def drop_can | ||
Devices.drawer_drop_can(@drawer_no) | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters