Sha256: 862cc487326a43c7dd80a784ad314111a61835b9bdd62e32f923087ef4792cb5

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

require_relative '../../../test_helper'
require_relative '../../../support/dummy_command'
require_relative '../../../../lib/vedeu/models/command'

module Vedeu
  describe Command do
    it 'has a name attribute' do
      Command.new({ name: 'dummy' }).name.must_equal('dummy')
    end

    it 'has an entity attribute' do
      Command.new({ entity: DummyCommand }).entity
        .must_equal(DummyCommand)
    end

    it 'has a keypress attribute' do
      Command.new({ keypress: 'd' }).keypress.must_equal('d')
    end

    it 'has an keyword attribute' do
      Command.new({ keyword: 'dummy' }).keyword.must_equal('dummy')
    end

    it 'has an arguments attribute' do
      Command.new({ arguments: [] }).arguments.must_equal([])
    end

    describe '#execute' do
      it 'returns the result of execution' do
        Command.new({
          name:      'dummy',
          entity:    DummyCommand,
          keyword:   'dummy',
          keypress:  'd',
          arguments: []
        }).execute(:dummy).must_equal(:dummy)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vedeu-0.0.39 test/lib/vedeu/models/command_test.rb
vedeu-0.0.38 test/lib/vedeu/models/command_test.rb
vedeu-0.0.37 test/lib/vedeu/models/command_test.rb
vedeu-0.0.36 test/lib/vedeu/models/command_test.rb
vedeu-0.0.35 test/lib/vedeu/models/command_test.rb
vedeu-0.0.34 test/lib/vedeu/models/command_test.rb
vedeu-0.0.33 test/lib/vedeu/models/command_test.rb