Sha256: 924cbeedf0e46546f5991b2966fa5734972b27cb7d01ce78698b59a0f888c73d

Contents?: true

Size: 853 Bytes

Versions: 2

Compression:

Stored size: 853 Bytes

Contents

module EventedSpec
  # Including EventedSpec::CoolioSpec module into your example group, each example of this group
  # will run inside cool.io loop without the need to explicitly call 'coolio'.
  #
  module CoolioSpec
    def self.included(example_group)
      example_group.send(:include, SpecHelper)
      example_group.extend ClassMethods
    end

    # @private
    module ClassMethods
      def it(*args, &block)
        if block
          # Shared example groups seem to pass example group instance
          # to the actual example block
          new_block = Proc.new {|example_group_instance| (example_group_instance || self).instance_eval { coolio(&block) } }
          super(*args, &new_block)
        else
          # pending example
          super
        end
      end # it
    end # ClassMethods
  end # EMSpec
end # module EventedSpec

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
evented-spec-0.9.0 lib/evented-spec/coolio_spec.rb
evented-spec-0.4.1 lib/evented-spec/coolio_spec.rb