Class: WebsocketRails::SpecHelperEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/spec_helpers/spec_helper_event.rb

Constant Summary

Constants included from Logging

Logging::ANSI, Logging::LOGGABLE_DATA

Instance Attribute Summary collapse

Attributes inherited from Event

#channel, #data, #id, #name, #namespace, #propagate, #result, #server_token, #success, #token, #user_id

Instance Method Summary collapse

Methods inherited from Event

#as_json, #encoded_name, #is_channel?, #is_internal?, #is_invalid?, #is_user?, log_header, new_from_json, #serialize, #should_propagate?

Methods included from Logging

#color_for_level, #colorize, configure, #log, #log_data?, #log_event, #log_event?, #log_event_end, #log_event_start, #log_exception, #log_header, log_level, #wrap

Methods included from StaticEvents

#new_on_close, #new_on_error, #new_on_invalid_event_received, #new_on_open, #new_on_ping

Constructor Details

#initialize(event_name, options = {}) ⇒ SpecHelperEvent

Returns a new instance of SpecHelperEvent.



9
10
11
12
13
# File 'lib/spec_helpers/spec_helper_event.rb', line 9

def initialize(event_name,options={})
  super(event_name, options)
  @triggered = false
  @dispatcher =  Dispatcher.new(nil)
end

Instance Attribute Details

#dispatcherObject (readonly)

Returns the value of attribute dispatcher.



5
6
7
# File 'lib/spec_helpers/spec_helper_event.rb', line 5

def dispatcher
  @dispatcher
end

#triggeredObject (readonly) Also known as: triggered?

Returns the value of attribute triggered.



5
6
7
# File 'lib/spec_helpers/spec_helper_event.rb', line 5

def triggered
  @triggered
end

Instance Method Details

#connectionObject



24
25
26
# File 'lib/spec_helpers/spec_helper_event.rb', line 24

def connection
  OpenStruct.new(:id => 1)
end

#dispatchObject



19
20
21
22
# File 'lib/spec_helpers/spec_helper_event.rb', line 19

def dispatch
  @dispatcher.dispatch(self)
  self
end

#triggerObject



15
16
17
# File 'lib/spec_helpers/spec_helper_event.rb', line 15

def trigger
  @triggered = true
end