Sha256: 71a7c4943ef322adb2a1b579de94106b8dfe2142ed6e58b79b50a4aaf014dc5d

Contents?: true

Size: 1.99 KB

Versions: 21

Compression:

Stored size: 1.99 KB

Contents

require File.dirname(__FILE__) + '/../../../spec_helper'
require 'spec/runner/formatter/failing_example_groups_formatter'

module Spec
  module Runner
    module Formatter
      describe FailingExampleGroupsFormatter do
        attr_reader :example_group, :formatter, :io

        before(:each) do
          @io = StringIO.new
          options = mock('options')
          @formatter = FailingExampleGroupsFormatter.new(options, io)
          @example_group = Class.new(::Spec::Example::ExampleGroup)
        end
        
        it "should add example name for each failure" do
          formatter.add_example_group(Class.new(ExampleGroup).describe("b 1"))
          formatter.example_failed("e 1", nil, Reporter::Failure.new(nil, RuntimeError.new))
          formatter.add_example_group(Class.new(ExampleGroup).describe("b 2"))
          formatter.example_failed("e 2", nil, Reporter::Failure.new(nil, RuntimeError.new))
          formatter.example_failed("e 3", nil, Reporter::Failure.new(nil, RuntimeError.new))
          io.string.should == "b 1\nb 2\n"
        end
        
        it "should delimit ExampleGroup superclass descriptions with :" do
          parent_example_group = Class.new(example_group).describe("Parent")
          child_example_group = Class.new(parent_example_group).describe("#child_method")
          grand_child_example_group = Class.new(child_example_group).describe("GrandChild")

          formatter.add_example_group(grand_child_example_group)
          formatter.example_failed("failure", nil, Reporter::Failure.new(nil, RuntimeError.new))
          io.string.should == "Parent#child_method GrandChild\n"
        end

        it "should remove druby url, which is used by Spec::Distributed" do
          @formatter.add_example_group(Class.new(ExampleGroup).describe("something something (druby://99.99.99.99:99)"))
          @formatter.example_failed("e 1", nil, Reporter::Failure.new(nil, RuntimeError.new))
          io.string.should == "something something\n"
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 4 rubygems

Version Path
picolena-0.0.99 app_generators/picolena/templates/vendor/plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
picolena-0.1.0 rails_plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
picolena-0.1.1 rails_plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
picolena-0.1.2 rails_plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
picolena-0.1.4 rails_plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
picolena-0.1.3 rails_plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
picolena-0.1.5 rails_plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
rspec-1.1.1 spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
rspec-1.1.0 spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
rspec-1.1.3 spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
rspec-1.1.2 spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
spree-0.2.0 vendor/plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
typo-5.0.2 vendor/plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
typo-5.0.1 vendor/plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
typo-5.0.3.98.1 vendor/plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
typo-5.0 vendor/plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
typo-5.0.3.98 vendor/plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
typo-5.1.2 vendor/plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
typo-5.1.1 vendor/plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb
typo-5.1.3 vendor/plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb