Sha256: 2bad1b18103bed6f623d7f16e8fcdc78bf31a6a0da4dde36babcc52e35d3edec

Contents?: true

Size: 956 Bytes

Versions: 3

Compression:

Stored size: 956 Bytes

Contents

require 'test_helper'

module Vedeu
  describe Style do
    describe '#to_s' do
      describe 'for a single style' do
        let(:values) { 'normal' }

        it 'returns an escape sequence' do
          Style.new(values).to_s.must_equal("\e[24m\e[22m\e[27m")
        end
      end

      describe 'for multiple styles' do
        let(:values) { ['normal', 'underline'] }

        it 'returns an escape sequence for multiple styles' do
          Style.new(values).to_s.must_equal("\e[24m\e[22m\e[27m\e[4m")
        end
      end

      describe 'for an unknown style' do
        let(:values) { 'unknown' }

        it 'returns an empty string for an unknown style' do
          Style.new(values).to_s.must_equal('')
        end
      end

      describe 'for an empty or nil' do
        let(:values) { '' }

        it 'returns an empty string for empty or nil' do
          Style.new(values).to_s.must_equal('')
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vedeu-0.1.18 test/lib/vedeu/models/style_test.rb
vedeu-0.1.17 test/lib/vedeu/models/style_test.rb
vedeu-0.1.16 test/lib/vedeu/models/style_test.rb