Sha256: c7afb7f945767671eeb9e4e7a56f4934f163f15d7f6404d1804a749ee73da413

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

require 'test_helper'

module Vedeu

  describe Key do

    let(:described) { Key.new(input, output) }
    let(:input)     { '' }
    let(:output)    { Proc.new { :output } }

    describe '#initialize' do
      it { return_type_for(described, Key) }
      it { assigns(described, '@input', input) }

      it { skip; assigns(described, '@output', output) }
    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.12 test/lib/vedeu/models/key_test.rb