Sha256: 0775a1aa964cafeedc2e93b01205bb72798d689f2caf1fbbca8d3aa23b4c0b20

Contents?: true

Size: 1.23 KB

Versions: 12

Compression:

Stored size: 1.23 KB

Contents

require "spec_helper"

describe "failed_results_re for autotest" do
  def run_example
    group = RSpec::Core::ExampleGroup.describe("group")
    example = group.example("example") { yield }
    io = StringIO.new
    formatter = RSpec::Core::Formatters::BaseTextFormatter.new(io)
    reporter = RSpec::Core::Reporter.new(formatter)

    group.run(reporter)
    reporter.report(1) {}
    io.string
  end

  shared_examples "autotest failed_results_re" do
    it "matches a failure" do
      output = run_example { fail }
      output.should match(Autotest::Rspec2.new.failed_results_re)
      output.should include(__FILE__.sub(File.expand_path('.'),'.'))
    end

    it "does not match when there are no failures" do
      output = run_example { } # pass
      output.should_not match(Autotest::Rspec2.new.failed_results_re)
      output.should_not include(__FILE__.sub(File.expand_path('.'),'.'))
    end
  end

  context "with color enabled" do
    before do
      RSpec.configuration.stub(:color_enabled? => true)
    end

    include_examples "autotest failed_results_re"
  end

  context "with color disabled " do
    before do
      RSpec.configuration.stub(:color_enabled? => false)
    end

    include_examples "autotest failed_results_re"
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
horseman-0.0.4 vendor/ruby/1.9.1/gems/rspec-core-2.7.1/spec/autotest/failed_results_re_spec.rb
horseman-0.0.3 vendor/ruby/1.9.1/gems/rspec-core-2.7.1/spec/autotest/failed_results_re_spec.rb
horseman-0.0.2 vendor/ruby/1.9.1/gems/rspec-core-2.7.1/spec/autotest/failed_results_re_spec.rb
nutshell-crm-0.0.6.alpha vendor/bundle/gems/rspec-core-2.7.1/spec/autotest/failed_results_re_spec.rb
nutshell-crm-0.0.5 vendor/bundle/gems/rspec-core-2.7.1/spec/autotest/failed_results_re_spec.rb
nutshell-crm-0.0.4 vendor/bundle/gems/rspec-core-2.7.1/spec/autotest/failed_results_re_spec.rb
nutshell-crm-0.0.3 vendor/bundle/gems/rspec-core-2.7.1/spec/autotest/failed_results_re_spec.rb
nutshell-crm-0.0.2 vendor/bundle/gems/rspec-core-2.7.1/spec/autotest/failed_results_re_spec.rb
nutshell-crm-0.0.1 vendor/bundle/gems/rspec-core-2.7.1/spec/autotest/failed_results_re_spec.rb
rspec-core-2.7.1 spec/autotest/failed_results_re_spec.rb
rspec-core-2.7.0 spec/autotest/failed_results_re_spec.rb
rspec-core-2.7.0.rc1 spec/autotest/failed_results_re_spec.rb