Sha256: bebf3d32c9ca455b41533d3e7415bfc68bb3a68f2fa7946df92a2e5c7c6e36e6
Contents?: true
Size: 1.52 KB
Versions: 3
Compression:
Stored size: 1.52 KB
Contents
require 'test_helper' module Vedeu describe Style do let(:described) { Style } describe '#initialize' do subject { described.new('bold') } it { subject.must_be_instance_of(described) } it { subject.instance_variable_get('@value').must_equal('bold') } end describe '#attributes' do subject { described.new('bold').attributes } it { subject.must_be_instance_of(Hash) } it 'returns an attributes hash for this instance' do subject.must_equal({ style: 'bold' }) end end describe '#to_s' do let(:value) {} subject { described.new(value).to_s } it { subject.must_be_instance_of(String) } it { subject.must_equal('') } describe 'for a single style' do let(:value) { 'normal' } it 'returns an escape sequence' do subject.must_equal("\e[24m\e[22m\e[27m") end end describe 'for multiple styles' do let(:value) { ['normal', 'underline'] } it 'returns an escape sequence for multiple styles' do subject.must_equal("\e[24m\e[22m\e[27m\e[4m") end end describe 'for an unknown style' do let(:value) { 'unknown' } it 'returns an empty string for an unknown style' do subject.must_equal('') end end describe 'for an empty or nil' do let(:value) { '' } it 'returns an empty string for empty or nil' do subject.must_equal('') end end end end # Style end # Vedeu
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.3.2 | test/lib/vedeu/presentation/style_test.rb |
vedeu-0.3.1 | test/lib/vedeu/presentation/style_test.rb |
vedeu-0.3.0 | test/lib/vedeu/presentation/style_test.rb |