class Tengine::RSpec::ContextWrapper
Kernelのcontextをラップするクラスです
Attributes
__driver__[RW]
Public Class Methods
new(kernel)
click to toggle source
# File lib/tengine/rspec/context_wrapper.rb, line 7 def initialize(kernel) @kernel = kernel @context = @kernel.context end
Public Instance Methods
__driver_class__()
click to toggle source
# File lib/tengine/rspec/context_wrapper.rb, line 38 def __driver_class__ @__driver_class__ ||= __driver__.target_class_name.constantize end
__driver_object__()
click to toggle source
# File lib/tengine/rspec/context_wrapper.rb, line 42 def __driver_object__ unless @__driver_object__ @__driver_object__ = __driver_class__.new __driver_class__.stub(:new).and_return(@__driver_object__) end @__driver_object__ end
receive(event_type_name, options = {})
click to toggle source
# File lib/tengine/rspec/context_wrapper.rb, line 12 def receive(event_type_name, options = {}) mock_headers = Object.new mock_headers.should_receive(:ack) raw_event = Tengine::Event.new({:event_type_name => event_type_name}.update(options || {})) @kernel.process_message(mock_headers, raw_event.to_json) end
should_fire(*args)
click to toggle source
# File lib/tengine/rspec/context_wrapper.rb, line 27 def should_fire(*args) @kernel.should_receive(:fire).with(*args) end
should_not_fire(*args)
click to toggle source
# File lib/tengine/rspec/context_wrapper.rb, line 30 def should_not_fire(*args) if args.empty? @kernel.should_not_receive(:fire) else @kernel.should_not_receive(:fire).with(*args) end end
should_not_receive(*args)
click to toggle source
# File lib/tengine/rspec/context_wrapper.rb, line 23 def should_not_receive(*args) @context.should_not_receive(*args) end
should_receive(*args)
click to toggle source
# File lib/tengine/rspec/context_wrapper.rb, line 19 def should_receive(*args) @context.should_receive(*args) end