Sha256: b55f4ce39aab42f18ca82bc6fac6fe3c5f3d40ffe3fd3111973b5c73af2305e6

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'
require 'rspec-search-and-destroy/io_output.rb'

module RSpecSearchAndDestroy
  describe IOOutput do
    let(:output) { IOOutput.new(io) }
    let(:io) { StringIO.new }
    subject(:string) { io.string }

    context "when reporting the culprit" do
      let(:causal_example) { {location: "cause location"} }
      let(:failed_example) { {location: "fail location"} }

      before do
        output.found(causal_example, failed_example)
      end

      it "includes the example that causes the problem" do
        expect(string).to match /Run\s+cause location/
      end

      it "includes the example that fails" do
        expect(string).to match /Before\s+fail location/
      end
    end

    context "when reporting progress" do
      let(:progress) do
        BisectionProgress.new(iteration: 5,
                              enabled_examples: 54,
                              total_examples: 999)
      end

      before do
        output.progress(progress)
      end

      it "includes the current iteration" do
        expect(string).to match /Iteration 5/
      end

      it "includes the number of enabled examples" do
        expect(string).to match /54.*examples/
      end

      it "includes the total number of examples" do
        expect(string).to match /999.*examples/
      end

      it "includes the running time" do
        expect(string).to match /Running for \d{2}:\d{2}:\d{2}/
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-search-and-destroy-0.0.4 spec/io_output_spec.rb