Module: EventMachine::UCEngine::Brick::Test
- Defined in:
- lib/em-ucengine/brick_test.rb
Overview
A simple class to allowing you to test your bricks
Instance Method Summary collapse
-
#brick ⇒ Object
Return the instance of the brick.
-
#trigger(name, data = {}) ⇒ Object
Trigger a U.C.Engine event into the brick.
Instance Method Details
#brick ⇒ Object
Return the instance of the brick
7 8 9 10 11 12 |
# File 'lib/em-ucengine/brick_test.rb', line 7 def brick return @b unless @b.nil? @b = app.new @b.start MiniTest::Mock.new @b end |
#trigger(name, data = {}) ⇒ Object
Trigger a U.C.Engine event into the brick
18 19 20 21 22 23 |
# File 'lib/em-ucengine/brick_test.rb', line 18 def trigger(name, data={}) event = data.merge "type" => name brick.routes[name].each do |proc| brick.instance_exec(event, &proc) end unless brick.routes[name].nil? end |