Sha256: ea85920bcc916e6912fac866f47ab165136fbe52515787e6019ce41a91ee5b96
Contents?: true
Size: 952 Bytes
Versions: 24
Compression:
Stored size: 952 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 { bad_keys.should have_failed InvalidKey, "#{:bad_key} is not a valid key" } end end
Version data entries
24 entries across 24 versions & 1 rubygems