class RSpec::EM::AsyncSteps

Public Instance Methods

included(klass) click to toggle source
# File lib/rspec/eventmachine/async_steps.rb, line 4
def included(klass)
  klass.__send__(:include, Scheduler)
end
method_added(method_name) click to toggle source
# File lib/rspec/eventmachine/async_steps.rb, line 8
    def method_added(method_name)
      async_method_name = "async_#{method_name}"

      return if instance_methods(false).map { |m| m.to_s }.include?(async_method_name) or
                method_name.to_s =~ /^async_/

      module_eval <<-RUBY, __FILE__, __LINE__ + 1
        alias :#{async_method_name} :#{method_name}

        def #{method_name}(*args)
          __enqueue__([#{async_method_name.inspect}] + args)
        end
      RUBY
    end