lib/spec/runner/options.rb in dchelimsky-rspec-1.1.11.1 vs lib/spec/runner/options.rb in dchelimsky-rspec-1.1.11.2

- old
+ new

@@ -38,11 +38,10 @@ :backtrace_tweaker, :context_lines, :diff_format, :dry_run, :profile, - :examples, :heckle_runner, :line_number, :loadby, :reporter, :reverse, @@ -54,11 +53,11 @@ :before_suite_parts, :after_suite_parts, # TODO: BT - Figure out a better name :argv ) - attr_reader :colour, :differ_class, :files, :example_groups + attr_reader :colour, :differ_class, :files, :examples, :example_groups def initialize(error_stream, output_stream) @error_stream = error_stream @output_stream = output_stream @filename_pattern = "**/*_spec.rb" @@ -110,11 +109,11 @@ if example_groups.empty? true else set_spec_from_line_number if line_number - success = runner.run + success = runner.run(self) @examples_run = true heckle if heckle_runner success end ensure @@ -161,11 +160,11 @@ end end def parse_example(example) if(File.file?(example)) - @examples = File.open(example).read.split("\n") + @examples = [File.open(example).read.split("\n")].flatten else @examples = [example] end end @@ -207,15 +206,12 @@ require "spec/runner/heckle_runner#{suffix}" @heckle_runner = HeckleRunner.new(heckle) end def number_of_examples - total = 0 - @example_groups.each do |example_group| - total += example_group.number_of_examples - end - total + return examples.size unless examples.empty? + @example_groups.inject(0) {|sum, group| sum + group.number_of_examples} end def files_to_load result = [] sorted_files.each do |file| @@ -228,9 +224,13 @@ else raise "File or directory not found: #{file}" end end result + end + + def dry_run? + @dry_run == true end protected def examples_should_be_run? return @examples_should_be_run unless @examples_should_be_run.nil?