instance method run_with_callbacks_and_mocha

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.2.3

Signature

run_with_callbacks_and_mocha(result)

Doubly unfortunate: mocha does the same so we have to hax their hax.

Parameters

result req
Source
# File activesupport/lib/active_support/testing/setup_and_teardown.rb, line 84
      def run_with_callbacks_and_mocha(result)
        return if @method_name.to_s == "default_test"

        yield(Test::Unit::TestCase::STARTED, name)
        @_result = result
        begin
          mocha_setup
          begin
            run_callbacks :setup
            setup
            __send__(@method_name)
            mocha_verify { add_assertion }
          rescue Mocha::ExpectationError => e
            add_failure(e.message, e.backtrace)
          rescue Test::Unit::AssertionFailedError => e
            add_failure(e.message, e.backtrace)
          rescue StandardError, ScriptError
            add_error($!)
          ensure
            begin
              teardown
              run_callbacks :teardown, :enumerator => :reverse_each
            rescue Test::Unit::AssertionFailedError => e
              add_failure(e.message, e.backtrace)
            rescue StandardError, ScriptError
              add_error($!)
            end
          end
        ensure
          mocha_teardown
        end
        result.add_run
        yield(Test::Unit::TestCase::FINISHED, name)
      end

Defined in activesupport/lib/active_support/testing/setup_and_teardown.rb line 84 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::Testing::SetupAndTeardown

Type at least 2 characters to search.

↑↓ navigate · open · esc close