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

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/lib/spec/runner/example_group_runner.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mfrom: (1.1.8 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080726154345-c03m49twzxewdwjn
Tags: 0.24.5-2
* Fix puppetlast to work with 0.24.5
* Adjust logcheck to match against new log messages in 0.24.5
* Update standards version to 3.8.0 (no changes)
* Update changelog to reduce length of line to make lintian happy

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
module Spec
 
2
  module Runner
 
3
    class ExampleGroupRunner
 
4
      def initialize(options)
 
5
        @options = options
 
6
      end
 
7
 
 
8
      def load_files(files)
 
9
        # It's important that loading files (or choosing not to) stays the
 
10
        # responsibility of the ExampleGroupRunner. Some implementations (like)
 
11
        # the one using DRb may choose *not* to load files, but instead tell
 
12
        # someone else to do it over the wire.
 
13
        files.each do |file|
 
14
          load file
 
15
        end
 
16
      end
 
17
 
 
18
      def run
 
19
        prepare
 
20
        success = true
 
21
        example_groups.each do |example_group|
 
22
          success = success & example_group.run
 
23
        end
 
24
        return success
 
25
      ensure
 
26
        finish
 
27
      end
 
28
 
 
29
      protected
 
30
      def prepare
 
31
        reporter.start(number_of_examples)
 
32
        example_groups.reverse! if reverse
 
33
      end
 
34
 
 
35
      def finish
 
36
        reporter.end
 
37
        reporter.dump
 
38
      end
 
39
 
 
40
      def reporter
 
41
        @options.reporter
 
42
      end
 
43
 
 
44
      def reverse
 
45
        @options.reverse
 
46
      end
 
47
 
 
48
      def example_groups
 
49
        @options.example_groups
 
50
      end
 
51
 
 
52
      def number_of_examples
 
53
        @options.number_of_examples
 
54
      end
 
55
    end
 
56
    # TODO: BT - Deprecate BehaviourRunner?
 
57
    BehaviourRunner = ExampleGroupRunner
 
58
  end
 
59
end
 
 
b'\\ No newline at end of file'