Fail when another window manager is already running

This commit is contained in:
Thibault Jouan
2015-04-12 23:46:34 +00:00
parent c3e1f9639a
commit 10591d0646
8 changed files with 47 additions and 10 deletions

View File

@@ -0,0 +1,8 @@
Feature: checking if another window manager is running
@other_wm_running
Scenario: fails when another window manager is running
Given another window manager is running
When I start uhwm
Then the exit status must be 70
And the current output must match /error.+other.+window.+manager/i

View File

@@ -2,7 +2,7 @@ def uhwm_wait_output message, timeout: 1
Timeout.timeout(timeout) do
loop do
break if case message
when Regexp then @process.read_stdout =~ message
when Regexp then @process.stdout + @process.stderr =~ message
when String then assert_partial_output_interactive message
end
sleep 0.1
@@ -28,6 +28,10 @@ options:
eoh
end
Then /^the output must match \/([^\/]+)\/([a-z]*)$/ do |pattern, options|
expect(@process.stdout).to match Regexp.new(pattern, options)
end
Then /^the current output must match \/([^\/]+)\/([a-z]*)$/ do |pattern, options|
uhwm_wait_output Regexp.new(pattern, options)
end

View File

@@ -9,6 +9,10 @@ def uhwm_run_wait_ready
uhwm_wait_output 'Connected to'
end
Given /^another window manager is running$/ do
expect(@other_wm).to be_alive
end
Given /^uhwm is running$/ do
uhwm_run_wait_ready
end

View File

@@ -14,3 +14,10 @@ Headless.new.start
After do |scenario|
@process and @process.terminate
end
Around '@other_wm_running' do |scenario, block|
@other_wm = ChildProcess.build('twm')
@other_wm.start
block.call
@other_wm.stop
end