require 'test_helper' module Vedeu describe HTMLChar do let(:described) { Vedeu::HTMLChar } let(:instance) { described.new(char, options) } let(:char) { Vedeu::Views::Char.new(attributes) } let(:options) { { start_tag: '', } } let(:attributes) { { border: border, colour: colour, parent: parent, value: _value } } let(:border) {} let(:colour) {} let(:parent) { Vedeu::Views::Line.new(colour: parent_colour) } let(:parent_colour) {} let(:_value) {} describe '#initialize' do it { instance.must_be_instance_of(described) } it { instance.instance_variable_get('@char').must_equal(char) } it { instance.instance_variable_get('@options').must_equal(options) } end describe '.render' do subject { described.render(char, options) } it { subject.must_be_instance_of(String) } context 'when there is a border' do let(:border) { :top_left } context 'when there is a colour' do let(:colour) { Vedeu::Colour.new(background: '#220022', foreground: '#aadd00') } it { subject.must_equal( " " ) } end context 'when there is no colour' do context 'when there is a parent colour' do let(:parent_colour) { Vedeu::Colour.new(background: '#002222', foreground: '#dd2200') } it { subject.must_equal( " " ) } end context 'when there is no parent colour' do it { subject.must_equal(" ") } end end end context 'when there is no border' do context 'when there is no value' do it { subject.must_equal(' ') } end context 'when the value is empty' do let(:_value) { '' } it { subject.must_equal(' ') } end context 'when there is a value' do let(:_value) { 'a' } it { subject.must_equal("a") } end end end end # HTMLChar end # Vedeu