Add scenario for no database.yml

MSP-11153
bug/bundler_fix
Luke Imhoff 2014-08-27 22:02:16 -05:00
parent 7453f6fa3a
commit 188f5d012a
No known key found for this signature in database
GPG Key ID: 5B1FB01FB33356F8
2 changed files with 27 additions and 1 deletions

View File

@ -135,4 +135,24 @@ Feature: `msfconsole` `database.yml`
When I run `msfconsole --environment test` interactively
And I wait for stdout to contain "Free Metasploit Pro trial: http://r-7.co/trymsp"
And I type "exit"
Then the output should contain "project_metasploit_framework_test"
Then the output should contain "project_metasploit_framework_test"
Scenario: Without --yaml, MSF_DATABASE_CONFIG, ~/.msf4/database.yml, or project "database.yml", no database connection
Given I unset the environment variables:
| variable |
| MSF_DATABASE_CONFIG |
And a directory named "home"
And I cd to "home"
And a mocked home directory
And I cd to "../.."
And the project "database.yml" does not exist
When I run `msfconsole --environment test` interactively
And I wait for stdout to contain "Free Metasploit Pro trial: http://r-7.co/trymsp"
And I type "db_status"
And I type "exit"
Then the output should not contain "command_line_metasploit_framework_test"
And the output should not contain "environment_metasploit_framework_test"
And the output should not contain "user_metasploit_framework_test"
And the output should not contain "project_metasploit_framework_test"
And the output should contain "[*] postgresql selected, no connection"

View File

@ -7,6 +7,12 @@ Before do
end
end
Given /^the project "database.yml" does not exist$/ do
if File.exist?(project_database_yaml_path)
File.rename(project_database_yaml_path, backup_project_database_yaml_path)
end
end
Given /^the project "database.yml" exists with:$/ do |file_content|
if File.exist?(project_database_yaml_path)
File.rename(project_database_yaml_path, backup_project_database_yaml_path)