Module: EventedSpec::SpecHelper::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
-
#default_options(opts = nil) ⇒ Hash
Sets/retrieves default AMQP.start options for this example group and its nested groups.
-
#default_timeout(spec_timeout = nil) ⇒ Float
Sets/retrieves default timeout for running evented specs for this example group and its nested groups.
-
#evented_spec_hooks ⇒ Hash
Collection of evented hooks for current example group.
-
#evented_spec_hooks_for(type) ⇒ Array
Collection of evented hooks of predefined type for current example group.
-
#evented_spec_metadata ⇒ Hash
Returns evented-spec related metadata for particular example group.
Methods included from EventMachineHelpers::GroupMethods
Methods included from CoolioHelpers::GroupHelpers
Methods included from AMQPHelpers::GroupMethods
Instance Method Details
#default_options(opts = nil) ⇒ Hash
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 (opts = nil) [:default_options] ||= {} if opts [:default_options].merge!(opts) else [:default_options] end end |
#default_timeout(spec_timeout = nil) ⇒ Float
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 [:spec_timeout] = spec_timeout else [:spec_timeout] || self.superclass.default_timeout end end |
#evented_spec_hooks ⇒ Hash
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 |
#evented_spec_hooks_for(type) ⇒ Array
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 |
#evented_spec_metadata ⇒ Hash
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 |