diff --git a/.travis.yml b/.travis.yml index f250a97..d2addaa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ -sudo: false language: ruby cache: bundler rvm: - 2.2 - ruby-head - 2.1 +before_install: + - sudo apt-get update -qq + - sudo apt-get install -qq xdotool diff --git a/features/steps/x_steps.rb b/features/steps/x_steps.rb index a900916..03d6933 100644 --- a/features/steps/x_steps.rb +++ b/features/steps/x_steps.rb @@ -2,12 +2,20 @@ def x_key key fail "cannot simulate X key `#{key}'" unless system "xdotool key #{key}" end +def x_socket_check pid + case RbConfig::CONFIG['host_os'] + when /linux/ + `netstat -xp`.lines.grep /\s+#{pid}\/ruby/ + else + `sockstat -u`.lines.grep /\s+ruby.+\s+#{pid}/ + end.any? +end + When /^I press the default quit key binding$/ do x_key 'alt+q' end Then /^it must connect to X display$/ do uhwm_wait_output 'Connected to' - expect(`sockstat -u`.lines.grep /\s+ruby.+\s+#{@process.pid}/) - .not_to be_empty + expect(x_socket_check @process.pid).to be true end