Sha256: 9113672a099407c476ae41a5da5e82d566111c8a3729254a3ef95c69a1d400f9

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

require 'test_helper'

module Vedeu

  describe Escape do

    let(:described)  { Vedeu::Escape }
    let(:instance)   { described.new(attributes) }
    let(:attributes) {
      {
        value:    _value,
        position: position,
      }
    }
    let(:_value)     { "\e[?25h" }
    let(:position)   { [2, 6] }

    describe '#initialize' do
      it { instance.must_be_instance_of(described) }
      it { instance.instance_variable_get('@value').must_equal(_value) }
    end

    describe 'accessors' do
      it { instance.must_respond_to(:value) }
    end

    describe '#null' do
      it { instance.null.must_equal(nil) }
      it { instance.background.must_equal(nil) }
      it { instance.colour.must_equal(nil) }
      it { instance.foreground.must_equal(nil) }
      it { instance.style.must_equal(nil) }
    end

    describe '#eql?' do
      let(:other) { instance }

      subject { instance.eql?(other) }

      it { subject.must_equal(true) }

      context 'when different to other' do
        let(:other) { described.new(value: 'b') }

        it { subject.must_equal(false) }
      end

      it { instance.must_respond_to(:==) }
    end

    describe '#position' do
      it { instance.position.must_be_instance_of(Vedeu::Position) }
    end

    describe '#value' do
      it { instance.value.must_be_instance_of(String) }
    end

    describe '#to_s' do
      subject { instance.to_s }

      it { instance.must_respond_to(:to_str) }
    end

  end # Escape

end # Vedeu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.6.4 test/lib/vedeu/models/escape_test.rb
vedeu-0.6.3 test/lib/vedeu/models/escape_test.rb
vedeu-0.6.2 test/lib/vedeu/models/escape_test.rb
vedeu-0.6.1 test/lib/vedeu/models/escape_test.rb
vedeu-0.6.0 test/lib/vedeu/models/escape_test.rb