Module: RR::Adapters::TestUnit

Includes:
RRMethods
Defined in:
lib/rr/adapters/test_unit.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RRMethods

#any_times, #anything, #boolean, #dont_allow, #duck_type, #hash_including, #instance_of, #is_a, #mock, #new_instance_of, #numeric, #proxy, #received, #reset, #satisfy, #spy, #strong, #stub, #verify

Methods included from DoubleDefinitions::Strategies::StrategyMethods

#any_instance_of!, #dont_allow!, #instance_of!, #mock!, #proxy!, #strong!, #stub!

Class Method Details

.included(mod) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rr/adapters/test_unit.rb', line 5

def self.included(mod)
  RR.trim_backtrace = true
  mod.class_eval do
    unless instance_methods.detect {|method_name| method_name.to_sym == :setup_with_rr}
      alias_method :setup_without_rr, :setup
      def setup_with_rr
        setup_without_rr
        RR.reset
      end
      alias_method :setup, :setup_with_rr

      alias_method :teardown_without_rr, :teardown
      def teardown_with_rr
        RR.verify
        teardown_without_rr
      end
      alias_method :teardown, :teardown_with_rr
    end
  end
end

Instance Method Details

#assert_received(subject, &block) ⇒ Object



26
27
28
# File 'lib/rr/adapters/test_unit.rb', line 26

def assert_received(subject, &block)
  block.call(received(subject)).call
end