Sha256: 89b6e88eb08612773082e01589ace04fc5c30794255b00067a2520d62a24ac2e

Contents?: true

Size: 1.35 KB

Versions: 7

Compression:

Stored size: 1.35 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 { subject.must_be_instance_of(String) }

      it { subject.must_equal('') }

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

        it { subject.must_equal("\e[1m") }
      end

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

        it { subject.must_equal("\e[2J") }
      end

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

        it { subject.must_equal("\e[?25l") }
      end

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

        it { subject.must_equal("\e[7m") }
      end

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

        it { subject.must_equal("\e[0m") }
      end

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

        it { subject.must_equal("\e[0m") }
      end

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

        it { subject.must_equal("\e[?25h") }
      end

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

        it { subject.must_equal("\e[4m") }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vedeu-0.0.14 test/lib/vedeu/output/style_test.rb
vedeu-0.0.13 test/lib/vedeu/output/style_test.rb
vedeu-0.0.12 test/lib/vedeu/output/style_test.rb
vedeu-0.0.11 test/lib/vedeu/output/style_test.rb
vedeu-0.0.10 test/lib/vedeu/output/style_test.rb
vedeu-0.0.9 test/lib/vedeu/output/style_test.rb
vedeu-0.0.8 test/lib/vedeu/output/style_test.rb