Sha256: 36b3ac631dc1ac83761023ff69cde1a15a3f852e6aa5c61f5a578aba5f0ab93e

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

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

module Vedeu
  describe Commands do
    let(:described_class) { Commands }

    describe '.define' do
      let(:subject) { described_class.define }

      context 'when a block is given' do
        let(:subject) { described_class.define { :nil } }

        it 'yields the block' do
          subject.must_be_instance_of(Symbol)
        end
      end

      context 'when a block is not given' do
        it { subject.must_be_instance_of(Module) }
      end
    end

    describe '.execute' do
      let(:subject) { described_class.execute(command) }
      let(:command) {}

      context 'when the command does not exist' do
        it { subject.must_be_instance_of(NilClass) }
      end

      context 'when the command exists' do
        let(:command) { "exit" }

        before { Exit.stubs(:dispatch).returns(true) }

        it { subject.must_be_instance_of(TrueClass) }
      end
    end

    describe '.list' do
      let(:subject) { described_class.list }

      it { subject.must_be_instance_of(String) }
    end

    describe '.add' do
      let(:subject) { described_class.add(command_name, command_klass, args, options) }
      let(:command_name)  { "some_name" }
      let(:command_klass) { DummyCommand }
      let(:args)          { [] }
      let(:options)       { {} }

      it { subject.must_be_instance_of(Hash) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.0.10 test/lib/vedeu/process/commands_test.rb