Sha256: 855b3dabae1d57899c0d8ff3c001565240f7d21228b70addd723a2796207d542

Contents?: true

Size: 1.52 KB

Versions: 10

Compression:

Stored size: 1.52 KB

Contents

# -*- coding: utf-8 -*-

require 'rspec/core/formatters/base_formatter'
require 'turnip_formatter/scenario/pass'
require 'turnip_formatter/scenario/failure'
require 'turnip_formatter/scenario/pending'
require 'turnip_formatter/printer/index'

module RSpec
  module Core
    module Formatters
      class TurnipFormatter < BaseFormatter
        attr_reader :passed_scenarios, :failed_scenarios, :pending_scenarios
        attr_reader :scenarios

        def initialize(output)
          super(output)
          @passed_scenarios  = []
          @failed_scenarios  = []
          @pending_scenarios = []
          @scenarios = []
        end

        def dump_summary(duration, example_count, failure_count, pending_count)
          super(duration, example_count, failure_count, pending_count)
          output.puts ::TurnipFormatter::Printer::Index.print_out(self)
        end

        def example_passed(example)
          super(example)

          scenario = ::TurnipFormatter::Scenario::Pass.new(example)
          @passed_scenarios << scenario
          @scenarios << scenario
        end

        def example_pending(example)
          super(example)

          scenario = ::TurnipFormatter::Scenario::Pending.new(example)
          @pending_scenarios << scenario
          @scenarios << scenario
        end

        def example_failed(example)
          super(example)

          scenario = ::TurnipFormatter::Scenario::Failure.new(example)
          @failed_scenarios << scenario
          @scenarios << scenario
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
turnip_formatter-0.2.11 lib/rspec/core/formatters/turnip_formatter.rb
turnip_formatter-0.2.10 lib/rspec/core/formatters/turnip_formatter.rb
turnip_formatter-0.2.9 lib/rspec/core/formatters/turnip_formatter.rb
turnip_formatter-0.2.8 lib/rspec/core/formatters/turnip_formatter.rb
turnip_formatter-0.2.7 lib/rspec/core/formatters/turnip_formatter.rb
turnip_formatter-0.2.6 lib/rspec/core/formatters/turnip_formatter.rb
turnip_formatter-0.2.5 lib/rspec/core/formatters/turnip_formatter.rb
turnip_formatter-0.2.4 lib/rspec/core/formatters/turnip_formatter.rb
turnip_formatter-0.2.3 lib/rspec/core/formatters/turnip_formatter.rb
turnip_formatter-0.2.2 lib/rspec/core/formatters/turnip_formatter.rb