Sha256: aefc8797afa12b178554da0936df82a5b930b66bbdc87acf24a4289926f689bc

Contents?: true

Size: 1.63 KB

Versions: 9

Compression:

Stored size: 1.63 KB

Contents

require 'test_helper'

module Vedeu

  describe Direct do

    let(:described) { Vedeu::Direct }
    let(:instance)  { described.new(value: _value, x: x, y: y) }
    let(:_value)    {}
    let(:x)         {}
    let(:y)         {}

    describe '#initialize' do
      it { instance.must_be_instance_of(described) }

      context 'when no value is given' do
        it { instance.instance_variable_get('@value').must_equal('') }
      end

      context 'when a value is given' do
        let(:_value) { 'some value' }

        it { instance.instance_variable_get('@value').must_equal('some value') }
      end

      context 'when no x is given' do
        it { instance.instance_variable_get('@x').must_equal(1) }
      end

      context 'when an x is given' do
        let(:x) { 6 }
        it { instance.instance_variable_get('@x').must_equal(6) }
      end

      context 'when no y is given' do
        it { instance.instance_variable_get('@y').must_equal(1) }
      end

      context 'when a y is given' do
        let(:y) { 3 }

        it { instance.instance_variable_get('@y').must_equal(3) }
      end
    end

    describe '.write' do
      before { Vedeu::Terminal.stubs(:output) }

      subject { described.write(value: _value, x: x, y: y) }

      it { subject.must_be_instance_of(String) }

      context 'when a value is given' do
        let(:_value) { 'some value' }

        it { subject.must_equal("\e[1;1Hsome value") }
      end

      context 'when a value is not given' do
        it { subject.must_equal("\e[1;1H") }
      end
    end

    describe '#write' do
      it { instance.must_respond_to(:write) }
    end

  end # Direct

end # Vedeu

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vedeu-0.6.8 test/lib/vedeu/output/direct_test.rb
vedeu-0.6.7 test/lib/vedeu/output/direct_test.rb
vedeu-0.6.6 test/lib/vedeu/output/direct_test.rb
vedeu-0.6.5 test/lib/vedeu/output/direct_test.rb
vedeu-0.6.4 test/lib/vedeu/output/direct_test.rb
vedeu-0.6.3 test/lib/vedeu/output/direct_test.rb
vedeu-0.6.2 test/lib/vedeu/output/direct_test.rb
vedeu-0.6.1 test/lib/vedeu/output/direct_test.rb
vedeu-0.6.0 test/lib/vedeu/output/direct_test.rb