lib/rspec-system/formatter.rb in rspec-system-1.5.0 vs lib/rspec-system/formatter.rb in rspec-system-1.6.0

- old
+ new

@@ -20,10 +20,11 @@ # Display test start information # # @param count [Fixnum] number of tests to run # @return [void] def start(count) + @max_tests = count super(count) output << "=================================================================\n\n" output << bold("Commencing rspec-system tests\n") output << bold("Total Test Count: ") << color(count, :cyan) << "\n\n" end @@ -33,11 +34,12 @@ # @param example [RSpec::Core::Example] example that is running # @return [void] def example_started(example) super(example) output << "=================================================================\n\n" - output << bold("Running test:\n ") << color(example.full_description, :magenta) << "\n\n" + output << bold("Running test: ") << "#{next_index} of #{@max_tests}" << "\n" + output << bold("Description:\n ") << color(example.full_description, :magenta) << "\n\n" end # Display output when an example has passed # # @param example [RSpec::Core::Example] example that is running @@ -64,19 +66,18 @@ # @return [void] def example_failed(example) super(example) msg = example.execution_result[:exception] output << "\n" << bold('Result: ') << failure_color('failed') << "\n" - output << bold("Index: ") << "#{next_failure_index}\n" output << bold("Reason:\n") << "#{msg}\n\n" end # Obtains next index value so we can keep a count of what test we are upto # # @api private # @return [Fixnum] index # - def next_failure_index - @next_failure_index ||= 0 - @next_failure_index += 1 + def next_index + @next_index ||= 0 + @next_index += 1 end end end