mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Improve Cucumber tests
The test for SSH connection name switching was faulty Improve the regexes used in the assertions
This commit is contained in:
parent
5c9b27e90d
commit
263295c423
3 changed files with 11 additions and 9 deletions
|
@ -6,12 +6,6 @@ Feature: SSH Connection
|
|||
And a task which executes as root
|
||||
|
||||
Scenario: Switching from default user to root and back again
|
||||
When I run cap "git:check"
|
||||
Then the task is successful
|
||||
And references in the remote repo are listed
|
||||
When I run cap "am_i_root"
|
||||
Then the task is successful
|
||||
And contains "root" in the output
|
||||
Then I run cap "git:check"
|
||||
Then the task is successful
|
||||
And references in the remote repo are listed
|
||||
And the output matches "I am uid=0\(root\)" followed by "I am uid=\d+\(vagrant\)"
|
||||
|
|
|
@ -106,10 +106,14 @@ When(/^an error is raised$/) do
|
|||
run_vagrant_command(test_file_exists(error))
|
||||
end
|
||||
|
||||
Then(/contains "(.*?)" in the output/) do |expected|
|
||||
Then(/contains "([^"]*)" in the output/) do |expected|
|
||||
expect(@output).to include(expected)
|
||||
end
|
||||
|
||||
Then(/doesn't contain "(.*?)" in the output/) do |expected|
|
||||
Then(/the output matches "([^"]*)" followed by "([^"]*)"/) do |expected, followedby|
|
||||
expect(@output).to match(/#{expected}.*#{followedby}/m)
|
||||
end
|
||||
|
||||
Then(/doesn't contain "([^"]*)" in the output/) do |expected|
|
||||
expect(@output).not_to include(expected)
|
||||
end
|
||||
|
|
|
@ -4,4 +4,8 @@ task :am_i_root do
|
|||
ident = capture :id, '-a'
|
||||
info "I am #{ident}"
|
||||
end
|
||||
on roles(:all) do |host|
|
||||
ident = capture :id, '-a'
|
||||
info "I am #{ident}"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue