Sha256: 576d7dbce4c28bcfb23053c0d70c96d4bbcde580a38b7bfa975179673beadacb

Contents?: true

Size: 1.84 KB

Versions: 19

Compression:

Stored size: 1.84 KB

Contents

require 'spec_helper'

describe Redcar::Runnables::OutputProcessor do
  before do
    @processor = Redcar::Runnables::OutputProcessor.new
  end
  
  def processed
    @processor.process(@input)
  end

  it "should htmlize output" do
    @input = "Some text with & and <tags/>"
    processed.should == "Some text with &amp; and &lt;tags/>"
    
    @input = "  Some indenting"
    processed.should == "&nbsp;&nbsp;Some indenting"
  end

  it "should convert ANSI colors to span classes" do
    @input = "Some \e[31mred\e[0m text."
    processed.should == 'Some <span class="ansi-red">red</span> text.'
  end

  it "should convert ANSI bold to span class" do
    @input = "Some \e[1;31mbold red\e[0m text."
    processed.should == 'Some <span class="ansi-bold ansi-red">bold red</span> text.'
  end

  it "should include ANSI light variants" do
    @input = "Some \e[93mlight yellow\e[0m text."
    processed.should == 'Some <span class="ansi-light ansi-yellow">light yellow</span> text.'
  end

  it "should close out all spans on ANSI 0m" do
    @input = "Some \e[1;32mbold green\e[0;32mregular green\e[0m"
    processed.should == 'Some <span class="ansi-bold ansi-green">bold green<span class="ansi-regular ansi-green">regular green</span></span>'
  end

  it "should close out all spans at then end of the line" do
    @input = "Some \e[34mblue text"
    processed.should == 'Some <span class="ansi-blue">blue text</span>'
  end

  it "should continue color in next line" do
    @input = "Some \e[34mblue text"
    processed
    @input = "that spans lines\e[0m"
    processed.should == '<span class="ansi-blue">that spans lines</span>'
  end

  it "should separate HTML output's head and body" do
    # This is a planned feature but will get implemented in another branch.
    # The intention is to somehow handle cucumbers --format html for interactive
    # runnable output.
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
redcar-0.13 plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.13.5dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.13.4dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.13.3dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.13.2dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.13.1dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-0.12.1 plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.13.0dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-0.12 plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.12.27dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.12.26dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.12.25dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.12.24dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.12.23dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.12.22dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.12.21dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.12.20dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.12.19dev plugins/runnables/spec/runnables/output_processor_spec.rb
redcar-dev-0.12.18dev plugins/runnables/spec/runnables/output_processor_spec.rb