mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-10-29 18:07:27 +01:00
Ensure a fake project database.yml is used for scenarios
MSP-11153 Ensures that cucumber still works if config/database.yml is not set and so other location is being used to run cucumber.
This commit is contained in:
parent
496865e591
commit
972470c241
@ -40,6 +40,13 @@ Feature: `msfconsole` `database.yml`
|
||||
username: user_metasploit_framework_test
|
||||
"""
|
||||
And I cd to "../.."
|
||||
And project "database.yml" exists with:
|
||||
"""
|
||||
test:
|
||||
adapter: postgresql
|
||||
database: project_metasploit_framework_test
|
||||
username: project_metasploit_framework_test
|
||||
"""
|
||||
When I run `msfconsole --environment test --yaml command_line.yml` interactively
|
||||
And I wait for stdout to contain "Free Metasploit Pro trial: http://r-7.co/trymsp"
|
||||
And I type "exit"
|
||||
@ -69,6 +76,13 @@ Feature: `msfconsole` `database.yml`
|
||||
username: user_metasploit_framework_test
|
||||
"""
|
||||
And I cd to "../.."
|
||||
And project "database.yml" exists with:
|
||||
"""
|
||||
test:
|
||||
adapter: postgresql
|
||||
database: project_metasploit_framework_test
|
||||
username: project_metasploit_framework_test
|
||||
"""
|
||||
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"
|
||||
@ -91,6 +105,13 @@ Feature: `msfconsole` `database.yml`
|
||||
username: user_metasploit_framework_test
|
||||
"""
|
||||
And I cd to "../.."
|
||||
And project "database.yml" exists with:
|
||||
"""
|
||||
test:
|
||||
adapter: postgresql
|
||||
database: project_metasploit_framework_test
|
||||
username: project_metasploit_framework_test
|
||||
"""
|
||||
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"
|
||||
|
22
features/step_definitions/project.rb
Normal file
22
features/step_definitions/project.rb
Normal file
@ -0,0 +1,22 @@
|
||||
project_database_yaml_path = Rails.root.join('config', 'database.yml').to_path
|
||||
backup_project_database_yaml_path = "#{project_database_yaml_path}.cucumber.bak"
|
||||
|
||||
Before do
|
||||
if File.exist?(backup_project_database_yaml_path)
|
||||
File.delete(backup_project_database_yaml_path)
|
||||
end
|
||||
end
|
||||
|
||||
Given /^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)
|
||||
end
|
||||
|
||||
write_file(project_database_yaml_path, file_content)
|
||||
end
|
||||
|
||||
After do
|
||||
if File.exist?(backup_project_database_yaml_path)
|
||||
File.rename(backup_project_database_yaml_path, project_database_yaml_path)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user