@@ -25,7 +25,7 @@ module Interactions
2525 describe KeyInput do
2626 let ( :key_input ) { KeyInput . new ( :name ) }
2727 let ( :key ) { 'a' }
28- let ( :interaction ) { KeyInput :: TypingInteraction . new ( key_input , :up , 'a' ) }
28+ let ( :interaction ) { TypingInteraction . new ( key_input , :up , 'a' ) }
2929
3030 describe '#type' do
3131 it 'returns :key' do
@@ -56,7 +56,7 @@ module Interactions
5656
5757 describe '#create_key_down' do
5858 it 'executes #add_action with created interaction' do
59- allow ( KeyInput :: TypingInteraction ) . to receive ( :new ) . with ( key_input , :down , key ) . and_return ( interaction )
59+ allow ( TypingInteraction ) . to receive ( :new ) . with ( key_input , :down , key ) . and_return ( interaction )
6060 allow ( key_input ) . to receive ( :add_action ) . and_call_original
6161
6262 key_input . create_key_down ( key )
@@ -67,35 +67,37 @@ module Interactions
6767
6868 describe '#create_key_up' do
6969 it 'executes #add_action with created interaction' do
70- allow ( KeyInput :: TypingInteraction ) . to receive ( :new ) . with ( key_input , :up , key ) . and_return ( interaction )
70+ allow ( TypingInteraction ) . to receive ( :new ) . with ( key_input , :up , key ) . and_return ( interaction )
7171 allow ( key_input ) . to receive ( :add_action ) . and_call_original
7272
7373 key_input . create_key_up ( key )
7474
7575 expect ( key_input ) . to have_received ( :add_action ) . with ( interaction )
7676 end
7777 end
78+ end # KeyInput
7879
79- describe 'KeyInput::TypingInteraction' do
80- let ( :source ) { Interactions . key ( 'keyboard' ) }
81- let ( :type ) { :down }
82- let ( :typing ) { KeyInput ::TypingInteraction . new ( source , type , key ) }
80+ describe TypingInteraction do
81+ let ( :source ) { Interactions . key ( 'keyboard' ) }
82+ let ( :type ) { :down }
83+ let ( :typing ) { TypingInteraction . new ( source , type , key ) }
84+ let ( :key ) { 'a' }
8385
84- it 'stores type as KeyInput::SUBTYPES' do
85- expect ( typing . type ) . to eq KeyInput ::SUBTYPES [ type ]
86- end
86+ it 'stores type as KeyInput::SUBTYPES' do
87+ expect ( typing . type ) . to eq KeyInput ::SUBTYPES [ type ]
88+ end
8789
88- it 'raises a TypeError if the passed type is not a key in KeyInput::SUBTYPES' do
89- expect { KeyInput :: TypingInteraction . new ( source , :none , key ) } . to raise_error ( TypeError )
90- end
90+ it 'raises a TypeError if the passed type is not a key in KeyInput::SUBTYPES' do
91+ expect { TypingInteraction . new ( source , :none , key ) } . to raise_error ( TypeError )
92+ end
9193
92- describe '#encode' do
93- it 'returns a Hash with type and value' do
94- expect ( typing . encode ) . to eq ( type : typing . type , value : key )
95- end
94+ describe '#encode' do
95+ it 'returns a Hash with type and value' do
96+ expect ( typing . encode ) . to eq ( type : typing . type , value : key )
9697 end
97- end # KeyInput::TypingInteraction
98- end # KeyInput
98+ end
99+ end # TypingInteraction
100+
99101 end # Interactions
100102 end # WebDriver
101103end # Selenium
0 commit comments