Sha256: f3b6a0430da54c94cad2da2571869125f6c4adae9edbb59a93fcfb3b85af6cbf

Contents?: true

Size: 825 Bytes

Versions: 3

Compression:

Stored size: 825 Bytes

Contents

module RR
  module Adapters
    module TestUnit
      include RRMethods

      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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rr-1.0.5 lib/rr/adapters/test_unit.rb
rr-1.0.5.rc2 lib/rr/adapters/test_unit.rb
rr-1.0.5.rc1 lib/rr/adapters/test_unit.rb