Sha256: 8cae3ad40e199848b6e271cec04703f74d61bfdccbf9feb11db7478ee90dafe3

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

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

module Vedeu
  describe Interface do
    let(:described_class)    { Interface }
    let(:described_instance) { described_class.new(attributes) }
    let(:attributes)         { { name: :test_interface } }
    let(:result)             {}

    before do
      Terminal.stubs(:input).returns('stop')
      Input.stubs(:evaluate).returns(result)
      Compositor.stubs(:arrange).returns([])
    end

    it { described_instance.must_be_instance_of(Interface) }

    describe '#create' do
      let(:subject) { described_class.create(attributes) }

      it { subject.must_be_instance_of(Interface) }
    end

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

      # it { proc { subject }.must_raise(NotImplementedError) }

      it { subject.must_be_instance_of(NilClass) }
    end

    describe '#origin' do
      it { skip }
    end

    describe '#initial_state' do
      it { skip }
    end

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

      context 'when the command evaluates to :stop' do
        let(:result) { :stop }

        it { proc { subject }.must_raise(Collapse) }
      end

      context 'when the command evaluates to anything else' do
        let(:result) { :something_else }

        it { subject.must_be_instance_of(NilClass) }
      end
    end

    describe '#output' do
      let(:subject) { described_instance.output }
      let(:command) { mock }

      it 'sends the output of the command to the compositor' do
        subject.must_be_instance_of(NilClass)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.0.11 test/lib/vedeu/repository/interface_test.rb