Sha256: a4620e6c86f67cb8acbb3604bfcf49985cf1bde2aad7e63df3322f325690761c

Contents?: true

Size: 846 Bytes

Versions: 1

Compression:

Stored size: 846 Bytes

Contents

require 'test_helper'

module Vedeu

  describe Key do

    let(:input)  { '' }
    let(:output) { proc { :output } }

    describe '#initialize' do
      it 'returns a new instance of Key' do
        Key.new(input, output).must_be_instance_of(Key)
      end
    end

    describe '#input' do
      it 'returns the key defined' do
        Key.new('a', output).input.must_equal('a')
      end

      context 'alias method #key' do
        it { Key.new('a', output).key.must_equal('a') }
      end
    end

    describe '#output' do
    end

    describe '#press' do
      it 'returns the result of calling the proc' do
        Key.new(input, output).press.must_equal(:output)
      end

      it 'returns a :noop when the output is not a proc' do
        Key.new(input, :output).press.must_equal(:noop)
      end
    end

  end # Key

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.2.11 test/lib/vedeu/models/key_test.rb