Class: EventMachine::Ventually::Eventually::RSpec

Inherits:
EventMachine::Ventually::Eventually show all
Defined in:
lib/em-ventually/eventually/rspec.rb

Instance Attribute Summary

Attributes inherited from EventMachine::Ventually::Eventually

#expectation

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from EventMachine::Ventually::Eventually

#formatted_message, #initialize, #kill_timer, #process_test, #run, #stop, #test

Constructor Details

This class inherits a constructor from EventMachine::Ventually::Eventually

Class Method Details

.injectObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/em-ventually/eventually/rspec.rb', line 5

def self.inject
  unless ::RSpec::Core::ExampleGroup.public_method_defined?(:_em)
    ::RSpec::Core::ExampleGroup.class_eval <<-EOT, __FILE__, __LINE__ + 1
    include EM::Ventually::Emify
    alias_method :original_instance_eval, :instance_eval
    def instance_eval(&block)
      _em { original_instance_eval(&block) }
    end
    EOT
  end
end

Instance Method Details

#assert_test(result) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/em-ventually/eventually/rspec.rb', line 21

def assert_test(result)
  e = expectation
  if super
    msg = formatted_message("#{result.inspect} passed")
    @runner.instance_eval do
      1.should == 1
    end
    true
  else
    false
  end
end

#report(msg) ⇒ Object



17
18
19
# File 'lib/em-ventually/eventually/rspec.rb', line 17

def report(msg)
  ::RSpec::Expectations.fail_with(msg)
end