Sha256: 0f2559b030bb7090d0a19e0c805e34a37e8a148c32a4cba81d0c92166bb95048
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
require 'test_helper' module Vedeu describe KeymapValidator do let(:described) { KeymapValidator.new(storage, key, interface) } let(:storage) { { 'dubnium' => { 'a' => proc { :do_something } }, '_global_keymap_' => { 'g' => proc { :do_something } } } } let(:key) { 'a' } let(:interface) { 'dubnium' } describe '.check' do it 'raises an exception when already in use as a system key' do proc { KeymapValidator.check(storage, :shift_tab, interface) }.must_raise(KeyInUse) end it 'raises an exception when already in use as a global key' do proc { KeymapValidator.check(storage, 'g', interface) }.must_raise(KeyInUse) end it 'raises an exception when already in use by the interface' do proc { KeymapValidator.check(storage, 'a', interface) }.must_raise(KeyInUse) end it 'raises an exception when already in use' do proc { KeymapValidator.check(storage, 'a', '') }.must_raise(KeyInUse) end it 'returns true when valid as a global key' do KeymapValidator.check(storage, 'h', '').must_equal(true) end it 'returns true when valid as an interface key' do KeymapValidator.check(storage, 'b', 'dubnium').must_equal(true) end end describe '#initialize' do it { return_type_for(described, KeymapValidator) } it { assigns(described, '@storage', storage) } it { assigns(described, '@key', key) } it { assigns(described, '@interface', interface) } end end # KeymapValidator end # Vedeu
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.2.12 | test/lib/vedeu/support/keymap_validator_test.rb |