From ae5d2f5b3132b6ce6fefe5fdef764616bbec3a5d Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 11 Sep 2015 13:10:37 +0200 Subject: Fix Ci::Ansi2html spec --- spec/lib/ci/ansi2html_spec.rb | 67 ++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/spec/lib/ci/ansi2html_spec.rb b/spec/lib/ci/ansi2html_spec.rb index 35f115f7f4a..75c023bbc43 100644 --- a/spec/lib/ci/ansi2html_spec.rb +++ b/spec/lib/ci/ansi2html_spec.rb @@ -1,133 +1,134 @@ require 'spec_helper' describe Ci::Ansi2html do + subject { Ci::Ansi2html } it "prints non-ansi as-is" do - Ansi2html::convert("Hello").should == 'Hello' + expect(subject.convert("Hello")).to eq('Hello') end it "strips non-color-changing controll sequences" do - Ansi2html::convert("Hello \e[2Kworld").should == 'Hello world' + expect(subject.convert("Hello \e[2Kworld")).to eq('Hello world') end it "prints simply red" do - Ansi2html::convert("\e[31mHello\e[0m").should == 'Hello' + expect(subject.convert("\e[31mHello\e[0m")).to eq('Hello') end it "prints simply red without trailing reset" do - Ansi2html::convert("\e[31mHello").should == 'Hello' + expect(subject.convert("\e[31mHello")).to eq('Hello') end it "prints simply yellow" do - Ansi2html::convert("\e[33mHello\e[0m").should == 'Hello' + expect(subject.convert("\e[33mHello\e[0m")).to eq('Hello') end it "prints default on blue" do - Ansi2html::convert("\e[39;44mHello").should == 'Hello' + expect(subject.convert("\e[39;44mHello")).to eq('Hello') end it "prints red on blue" do - Ansi2html::convert("\e[31;44mHello").should == 'Hello' + expect(subject.convert("\e[31;44mHello")).to eq('Hello') end it "resets colors after red on blue" do - Ansi2html::convert("\e[31;44mHello\e[0m world").should == 'Hello world' + expect(subject.convert("\e[31;44mHello\e[0m world")).to eq('Hello world') end it "performs color change from red/blue to yellow/blue" do - Ansi2html::convert("\e[31;44mHello \e[33mworld").should == 'Hello world' + expect(subject.convert("\e[31;44mHello \e[33mworld")).to eq('Hello world') end it "performs color change from red/blue to yellow/green" do - Ansi2html::convert("\e[31;44mHello \e[33;42mworld").should == 'Hello world' + expect(subject.convert("\e[31;44mHello \e[33;42mworld")).to eq('Hello world') end it "performs color change from red/blue to reset to yellow/green" do - Ansi2html::convert("\e[31;44mHello\e[0m \e[33;42mworld").should == 'Hello world' + expect(subject.convert("\e[31;44mHello\e[0m \e[33;42mworld")).to eq('Hello world') end it "ignores unsupported codes" do - Ansi2html::convert("\e[51mHello\e[0m").should == 'Hello' + expect(subject.convert("\e[51mHello\e[0m")).to eq('Hello') end it "prints light red" do - Ansi2html::convert("\e[91mHello\e[0m").should == 'Hello' + expect(subject.convert("\e[91mHello\e[0m")).to eq('Hello') end it "prints default on light red" do - Ansi2html::convert("\e[101mHello\e[0m").should == 'Hello' + expect(subject.convert("\e[101mHello\e[0m")).to eq('Hello') end it "performs color change from red/blue to default/blue" do - Ansi2html::convert("\e[31;44mHello \e[39mworld").should == 'Hello world' + expect(subject.convert("\e[31;44mHello \e[39mworld")).to eq('Hello world') end it "performs color change from light red/blue to default/blue" do - Ansi2html::convert("\e[91;44mHello \e[39mworld").should == 'Hello world' + expect(subject.convert("\e[91;44mHello \e[39mworld")).to eq('Hello world') end it "prints bold text" do - Ansi2html::convert("\e[1mHello").should == 'Hello' + expect(subject.convert("\e[1mHello")).to eq('Hello') end it "resets bold text" do - Ansi2html::convert("\e[1mHello\e[21m world").should == 'Hello world' - Ansi2html::convert("\e[1mHello\e[22m world").should == 'Hello world' + expect(subject.convert("\e[1mHello\e[21m world")).to eq('Hello world') + expect(subject.convert("\e[1mHello\e[22m world")).to eq('Hello world') end it "prints italic text" do - Ansi2html::convert("\e[3mHello").should == 'Hello' + expect(subject.convert("\e[3mHello")).to eq('Hello') end it "resets italic text" do - Ansi2html::convert("\e[3mHello\e[23m world").should == 'Hello world' + expect(subject.convert("\e[3mHello\e[23m world")).to eq('Hello world') end it "prints underlined text" do - Ansi2html::convert("\e[4mHello").should == 'Hello' + expect(subject.convert("\e[4mHello")).to eq('Hello') end it "resets underlined text" do - Ansi2html::convert("\e[4mHello\e[24m world").should == 'Hello world' + expect(subject.convert("\e[4mHello\e[24m world")).to eq('Hello world') end it "prints concealed text" do - Ansi2html::convert("\e[8mHello").should == 'Hello' + expect(subject.convert("\e[8mHello")).to eq('Hello') end it "resets concealed text" do - Ansi2html::convert("\e[8mHello\e[28m world").should == 'Hello world' + expect(subject.convert("\e[8mHello\e[28m world")).to eq('Hello world') end it "prints crossed-out text" do - Ansi2html::convert("\e[9mHello").should == 'Hello' + expect(subject.convert("\e[9mHello")).to eq('Hello') end it "resets crossed-out text" do - Ansi2html::convert("\e[9mHello\e[29m world").should == 'Hello world' + expect(subject.convert("\e[9mHello\e[29m world")).to eq('Hello world') end it "can print 256 xterm fg colors" do - Ansi2html::convert("\e[38;5;16mHello").should == 'Hello' + expect(subject.convert("\e[38;5;16mHello")).to eq('Hello') end it "can print 256 xterm fg colors on normal magenta background" do - Ansi2html::convert("\e[38;5;16;45mHello").should == 'Hello' + expect(subject.convert("\e[38;5;16;45mHello")).to eq('Hello') end it "can print 256 xterm bg colors" do - Ansi2html::convert("\e[48;5;240mHello").should == 'Hello' + expect(subject.convert("\e[48;5;240mHello")).to eq('Hello') end it "can print 256 xterm bg colors on normal magenta foreground" do - Ansi2html::convert("\e[48;5;16;35mHello").should == 'Hello' + expect(subject.convert("\e[48;5;16;35mHello")).to eq('Hello') end it "prints bold colored text vividly" do - Ansi2html::convert("\e[1;31mHello\e[0m").should == 'Hello' + expect(subject.convert("\e[1;31mHello\e[0m")).to eq('Hello') end it "prints bold light colored text correctly" do - Ansi2html::convert("\e[1;91mHello\e[0m").should == 'Hello' + expect(subject.convert("\e[1;91mHello\e[0m")).to eq('Hello') end end -- cgit v1.2.1