Sha256: 2694fd8219430afd1a28ff38fe01d1acaa2e2e772bfd775ca09799702d49cd16

Contents?: true

Size: 1.82 KB

Versions: 4

Compression:

Stored size: 1.82 KB

Contents

require_relative '../../../test_helper'

module Vedeu
  describe Style do
    let(:described_class) { Style }

    describe '.set' do
      let(:subject) { described_class.set(style) }
      let(:style) {}

      it 'returns a String' do
        subject.must_be_instance_of(String)
      end

      it 'returns an empty string' do
        subject.must_equal('')
      end

      context 'when the style is bold' do
        let(:style) { :bold }

        it 'returns an escape sequence' do
          subject.must_equal("\e[1m")
        end
      end

      context 'when the style is clear' do
        let(:style) { :clear }

        it 'returns an escape sequence' do
          subject.must_equal("\e[2J")
        end
      end

      context 'when the style is hide_cursor' do
        let(:style) { :hide_cursor }

        it 'returns an escape sequence' do
          subject.must_equal("\e[?25l")
        end
      end

      context 'when the style is inverse' do
        let(:style) { :inverse }

        it 'returns an escape sequence' do
          subject.must_equal("\e[7m")
        end
      end

      context 'when the style is reset' do
        let(:style) { :reset }

        it 'returns an escape sequence' do
          subject.must_equal("\e[0m")
        end
      end

      context 'when the style is normal' do
        let(:style) { :normal }

        it 'returns an escape sequence' do
          subject.must_equal("\e[0m")
        end
      end

      context 'when the style is show_cursor' do
        let(:style) { :show_cursor }

        it 'returns an escape sequence' do
          subject.must_equal("\e[?25h")
        end
      end

      context 'when the style is underline' do
        let(:style) { :underline }

        it 'returns an escape sequence' do
          subject.must_equal("\e[4m")
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.0.18 test/lib/vedeu/output/style_test.rb
vedeu-0.0.17 test/lib/vedeu/output/style_test.rb
vedeu-0.0.16 test/lib/vedeu/output/style_test.rb
vedeu-0.0.15 test/lib/vedeu/output/style_test.rb