Refactor cucumber scenarios

This commit is contained in:
Thibault Jouan 2015-04-15 01:17:35 +00:00
parent 9c9aa1dabb
commit 75cd101739
2 changed files with 8 additions and 6 deletions

View File

@ -1,28 +1,25 @@
Feature: `key' run control keyword Feature: `key' run control keyword
Scenario: defines code to run when given key is pressed Scenario: defines code to run when given key is pressed
Given a run control file with: Given uhwm is running with this run control file:
""" """
key(:f) { puts 'trigger f key code' } key(:f) { puts 'trigger f key code' }
""" """
And uhwm is running
When I press the alt+f keys When I press the alt+f keys
Then the output must contain "trigger f key code" Then the output must contain "trigger f key code"
Scenario: translates common key names to their X equivalent Scenario: translates common key names to their X equivalent
Given a run control file with: Given uhwm is running with this run control file:
""" """
key(:enter) { puts 'trigger return key code' } key(:enter) { puts 'trigger return key code' }
""" """
And uhwm is running
When I press the alt+Return keys When I press the alt+Return keys
Then the output must contain "trigger return key code" Then the output must contain "trigger return key code"
Scenario: translates upcased key names to combination with shift key Scenario: translates upcased key names to combination with shift key
Given a run control file with: Given uhwm is running with this run control file:
""" """
key(:F) { puts 'trigger shift+f key code' } key(:F) { puts 'trigger shift+f key code' }
""" """
And uhwm is running
When I press the alt+shift+f keys When I press the alt+shift+f keys
Then the output must contain "trigger shift+f key code" Then the output must contain "trigger shift+f key code"

View File

@ -6,6 +6,11 @@ Given /^uhwm is running$/ do
uhwm_run_wait_ready uhwm_run_wait_ready
end end
Given /^uhwm is running with this run control file:$/ do |rc|
write_file '.uhwmrc.rb', rc
uhwm_run_wait_ready
end
When /^I start uhwm$/ do When /^I start uhwm$/ do
uhwm_run uhwm_run
end end