Sha256: b2dbb197626371e225d8b1e7aba0dee59100a47bcc7a5f4b6c73900aed94016a

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

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

module Vedeu
  describe Background do
    let(:described_class)    { Background }
    let(:described_instance) { described_class.new(colour) }
    let(:colour)             {}

    it { described_instance.must_be_instance_of(Background) }

    describe '#escape_sequence' do
      let(:subject) { described_instance.escape_sequence }

      it { subject.must_be_instance_of(String) }

      context 'with no colour' do
        it { subject.must_be_instance_of(String) }

        it { subject.must_equal("\e[48;5;49m") }
      end

      context 'with a named colour' do
        let(:colour) { :red }

        it { subject.must_be_instance_of(String) }

        it { subject.must_equal("\e[48;5;41m") }
      end

      context 'with a html colour' do
        let(:colour) { '#aadd00' }

        it { subject.must_be_instance_of(String) }

        it { subject.must_equal("\e[48;5;148m") }
      end

      context 'with a default colour' do
        let(:colour) { :undefined }

        it { subject.must_be_instance_of(String) }

        it { subject.must_equal("\e[48;5;49m") }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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