Module: EventedSpec::SpecHelper::GroupMethods

Includes:
AMQPHelpers::GroupMethods, CoolioHelpers::GroupHelpers, EventMachineHelpers::GroupMethods
Defined in:
lib/evented-spec/spec_helper.rb,
lib/evented-spec/spec_helper/amqp_helpers.rb,
lib/evented-spec/spec_helper/coolio_helpers.rb,
lib/evented-spec/spec_helper/event_machine_helpers.rb

Overview

Class methods (macros) for any example groups that includes SpecHelper. You can use these methods as macros inside describe/context block.

Instance Method Summary (collapse)

Methods included from EventMachineHelpers::GroupMethods

#em_after, #em_before

Methods included from CoolioHelpers::GroupHelpers

#coolio_after, #coolio_before

Methods included from AMQPHelpers::GroupMethods

#amqp_after, #amqp_before

Instance Method Details

- (Hash) default_options(opts = nil)

Sets/retrieves default AMQP.start options for this example group and its nested groups.



71
72
73
74
75
76
77
78
# File 'lib/evented-spec/spec_helper.rb', line 71

def default_options(opts = nil)
  [:default_options] ||= {}
  if opts
    [:default_options].merge!(opts)
  else
    [:default_options]
  end
end

- (Float) default_timeout(spec_timeout = nil)

Sets/retrieves default timeout for running evented specs for this example group and its nested groups.



58
59
60
61
62
63
64
# File 'lib/evented-spec/spec_helper.rb', line 58

def default_timeout(spec_timeout = nil)
  if spec_timeout
    default_options[:spec_timeout] = spec_timeout
  else
    default_options[:spec_timeout] || self.superclass.default_timeout
  end
end

- (Hash) evented_spec_hooks

Collection of evented hooks for current example group



83
84
85
# File 'lib/evented-spec/spec_helper.rb', line 83

def evented_spec_hooks
  [:es_hooks] ||= Hash.new
end

- (Array) evented_spec_hooks_for(type)

Collection of evented hooks of predefined type for current example group



91
92
93
# File 'lib/evented-spec/spec_helper.rb', line 91

def evented_spec_hooks_for(type)
  evented_spec_hooks[type] ||= []
end

- (Hash) evented_spec_metadata

Returns evented-spec related metadata for particular example group. Metadata is cloned from parent to children, so that children inherit all the options and hooks set in parent example groups



44
45
46
47
48
49
50
51
# File 'lib/evented-spec/spec_helper.rb', line 44

def 
  if @evented_spec_metadata
    @evented_spec_metadata
  else
    @evented_spec_metadata = superclass. rescue {}
    @evented_spec_metadata = EventedSpec::Util.deep_clone(@evented_spec_metadata)
  end
end