Sha256: 19d40ebadf1801ce70546191033fd2dec7b54f92009a2086ff0c026e720855ec

Contents?: true

Size: 1.28 KB

Versions: 10

Compression:

Stored size: 1.28 KB

Contents

module Spec
  module Runner
    class ExampleGroupRunner
      def initialize(options)
        @options = options
      end

      def load_files(files)
        # It's important that loading files (or choosing not to) stays the
        # responsibility of the ExampleGroupRunner. Some implementations (like)
        # the one using DRb may choose *not* to load files, but instead tell
        # someone else to do it over the wire.
        files.each do |file|
          load file
        end
      end

      def run(run_options)
        prepare
        success = true
        example_groups.each do |example_group|
          success = success & example_group.run(run_options)
        end
        return success
      ensure
        finish
      end

      protected
      def prepare
        reporter.start(number_of_examples)
        example_groups.reverse! if reverse
      end

      def finish
        reporter.end
        reporter.dump
      end

      def reporter
        @options.reporter
      end

      def reverse
        @options.reverse
      end

      def example_groups
        @options.example_groups
      end

      def number_of_examples
        @options.number_of_examples
      end
    end
    # TODO: BT - Deprecate BehaviourRunner?
    BehaviourRunner = ExampleGroupRunner
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
dchelimsky-rspec-1.1.11.2 lib/spec/runner/example_group_runner.rb
dchelimsky-rspec-1.1.11.3 lib/spec/runner/example_group_runner.rb
dchelimsky-rspec-1.1.11.4 lib/spec/runner/example_group_runner.rb
dchelimsky-rspec-1.1.11.5 lib/spec/runner/example_group_runner.rb
dchelimsky-rspec-1.1.11.6 lib/spec/runner/example_group_runner.rb
spree-0.6.0 vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb
spree-0.7.0 vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb
spree-0.7.1 vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb
spree-0.8.0 vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb
spree-0.8.1 vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb