lib/cucumber/chef/steps/ssh_steps.rb in cucumber-chef-2.1.0.rc.12 vs lib/cucumber/chef/steps/ssh_steps.rb in cucumber-chef-2.1.0.rc.14
- old
+ new
@@ -89,36 +89,27 @@
parent = File.dirname path
child = File.basename path
command = "ls %s" % [
parent
]
- @output = @connection.exec(command).output
+ @output = @connection.exec(command, :silence => true).output
@output.should =~ /#{child}/
# if a specific type (directory|file) was specified, test for it
command = "stat -c %%F %s" % [
path
]
- @output = @connection.exec(command).output
+ @output = @connection.exec(command, :silence => true).output
types = {
"file" => /regular file/,
"directory" => /directory/,
"symlink" => /symbolic link/
}
if types.keys.include? type
@output.should =~ types[type]
end
-# if type == "file"
-# @output.should =~ /regular file/
-# end
-# if type == "directory"
-# @output.should =~ /directory/
-# end
-# if type == "symlink"
-# @output.should =~ /symbolic link/
-# end
end
Then /^(?:path|directory|file) "([^\"]*)" should be owned by "([^\"]*)"$/ do |path, owner|
command = "stat -c %%U:%%G %s" % [
path
@@ -168,18 +159,18 @@
end
end
Then /^package "([^\"]*)" should be installed$/ do |package|
command = ""
- if (dpkg = @connection.exec("which dpkg 2> /dev/null").output).length > 0
+ if (dpkg = @connection.exec("which dpkg 2> /dev/null", silence: true).output).length > 0
command = "#{dpkg.chomp} --get-selections"
- elsif (yum = @connection.exec("which yum 2> /dev/null").output).length > 0
+ elsif (yum = @connection.exec("which yum 2> /dev/null", silence: true).output).length > 0
command = "#{yum.chomp} -q list installed"
# could easily add more cases here, if I knew what they were :)
end
- @output = @connection.exec(command)
- @output.should =~ /#{package}/
+ @result = @connection.exec(command, :silence => true)
+ @result.output.should =~ /#{package}/
end
# This regex is a little ugly, but it's so we can accept any of these
#
# * "foo" is running