# encoding: utf-8
require 'spec_helper'
require 'shell2html'
describe Shell2html do
let(:unknown_text) { "\e[12mtext\e[0m" }
let(:blue_text) { "\e[34mtext\e[0m" }
let(:bold_blue_text) { "\e[1;34mtext\e[0m" }
describe '.to_html' do
context 'when we need css classes, ' do
context 'when we input a text with an unknown foreground color, ' do
it { expect(subject.to_html(unknown_text)).to eq 'text' }
end
context 'when we input a text with a simple foreground color, ' do
it { expect(subject.to_html(blue_text)).to eq 'text' }
end
context 'when we input a text with a bold foreground color, ' do
it { expect(subject.to_html(bold_blue_text)).to eq 'text' }
end
end
context 'when we need inline styles, ' do
context 'when we input a text with a simple foreground color, ' do
it { expect(subject.to_html(blue_text,true)).to eq 'text' }
end
end
end
describe '.css' do
let(:expected) { File.read(File.expand_path('../../files/colors.css', __FILE__)) }
it { expect(subject.css).to eq expected }
end
describe '.sass' do
let(:expected) { File.read(File.expand_path('../../files/colors.sass', __FILE__)) }
it { expect(subject.sass).to eq expected }
end
end