~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/lib/spec/interop/test/unit/ui/console/testrunner.rb

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Pollock
  • Date: 2009-04-13 17:12:47 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (3.1.3 squeeze) (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20090413171247-61zlnwi5esw1lhtv
ImportĀ upstreamĀ versionĀ 0.24.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require 'test/unit/ui/console/testrunner'
2
 
 
3
 
module Test
4
 
  module Unit
5
 
    module UI
6
 
      module Console
7
 
        class TestRunner
8
 
 
9
 
          alias_method :started_without_rspec, :started
10
 
          def started_with_rspec(result)
11
 
            @result = result
12
 
            @need_to_output_started = true
13
 
          end
14
 
          alias_method :started, :started_with_rspec
15
 
 
16
 
          alias_method :test_started_without_rspec, :test_started
17
 
          def test_started_with_rspec(name)
18
 
            if @need_to_output_started
19
 
              if @rspec_io
20
 
                @rspec_io.rewind
21
 
                output(@rspec_io.read)
22
 
              end
23
 
              output("Started")
24
 
              @need_to_output_started = false
25
 
            end
26
 
            test_started_without_rspec(name)
27
 
          end
28
 
          alias_method :test_started, :test_started_with_rspec
29
 
 
30
 
          alias_method :test_finished_without_rspec, :test_finished
31
 
          def test_finished_with_rspec(name)
32
 
            test_finished_without_rspec(name)
33
 
            @ran_test = true
34
 
          end
35
 
          alias_method :test_finished, :test_finished_with_rspec
36
 
 
37
 
          alias_method :finished_without_rspec, :finished
38
 
          def finished_with_rspec(elapsed_time)
39
 
            @ran_test ||= false
40
 
            if @ran_test
41
 
              finished_without_rspec(elapsed_time)
42
 
            end
43
 
          end
44
 
          alias_method :finished, :finished_with_rspec
45
 
          
46
 
          alias_method :setup_mediator_without_rspec, :setup_mediator
47
 
          def setup_mediator_with_rspec
48
 
            orig_io = @io
49
 
            @io = StringIO.new
50
 
            setup_mediator_without_rspec
51
 
          ensure
52
 
            @rspec_io = @io
53
 
            @io = orig_io
54
 
          end
55
 
          alias_method :setup_mediator, :setup_mediator_with_rspec
56
 
          
57
 
        end
58
 
      end
59
 
    end
60
 
  end
61
 
end