Sha256: 6810afe43baa4a78b0f217a5d497472be7c679aaf09a0a95fff2a8f3c60719d7
Contents?: true
Size: 956 Bytes
Versions: 2
Compression:
Stored size: 956 Bytes
Contents
require 'spec_helper' describe Uia::Keys do def encode(*keys) Keys.encode keys end Then { encode('Bacon sandwich') == 'Bacon sandwich' } Then { encode([:control, :shift, 'a']) == '^(+a)' } context 'special keys' do Then { encode(:shift, :f2, :left) == '+{F2}{LEFT}' } end context 'special characters' do Then { encode('1 + 2') == '1 {+} 2' } Then { encode('1 ^^ 2') == '1 {^}{^} 2' } Then { encode('a%b') == 'a{%}b' } Then { encode('~ish') == '{~}ish' } Then { encode('(1 - 2)') == '{(}1 - 2{)}' } Then { encode('{DUDE}') == '{{}DUDE{}}' } Then { encode('[DUDE]') == '{[}DUDE{]}' } Then { encode('(Bacon + sand%wich^ [sweet] {}') == '{(}Bacon {+} sand{%}wich{^} {[}sweet{]} {{}{}}' } end context 'invalid' do When(:bad_keys) { encode('something', :bad_key) } Then { expect(bad_keys).to have_failed InvalidKey, "#{:bad_key} is not a valid key" } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
uia-0.8 | spec/uia/keys_spec.rb |
uia-0.7 | spec/uia/keys_spec.rb |