Sha256: 99801c0b08a0200f052b60fcc1aad7a28dc6441ce96ffea2b415a08adf192967

Contents?: true

Size: 1.65 KB

Versions: 4

Compression:

Stored size: 1.65 KB

Contents

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

module Vedeu
  describe Command do
    let(:described_class)    { Command }
    let(:described_instance) { described_class.new(attributes) }
    let(:subject)            { described_instance }
    let(:attributes)         {
      {
        name:    'dummy',
        klass:   DummyCommand,
        options: {
          keyword:  "dummy",
          keypress: "d"
        }
      }
    }

    it 'returns a Command instance' do
      subject.must_be_instance_of(Command)
    end

    it 'sets an instance variable' do
      subject.instance_variable_get("@attributes").must_equal(attributes)
    end

    it 'sets an instance variable' do
      subject.instance_variable_get("@name").must_equal('dummy')
    end

    it 'sets an instance variable' do
      subject.instance_variable_get("@klass").must_equal(DummyCommand)
    end

    it 'sets an instance variable' do
      subject.instance_variable_get("@keyword").must_equal('dummy')
    end

    it 'sets an instance variable' do
      subject.instance_variable_get("@keypress").must_equal('d')
    end

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

      it 'returns a Command instance' do
        subject.must_be_instance_of(Command)
      end
    end

    describe '#execute' do
      let(:subject) { described_instance.execute(args) }
      let(:args)    { [] }

      it 'returns a Symbol' do
        subject.must_be_instance_of(Symbol)
      end

      it 'returns the result of execution' do
        subject.must_equal(:dummy)
      end
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.0.18 test/lib/vedeu/repository/command_test.rb
vedeu-0.0.17 test/lib/vedeu/repository/command_test.rb
vedeu-0.0.16 test/lib/vedeu/repository/command_test.rb
vedeu-0.0.15 test/lib/vedeu/repository/command_test.rb