Skip to content
This repository has been archived by the owner on Nov 11, 2017. It is now read-only.

Commit

Permalink
Fakes out the heroku command for cucumber.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Yurek committed Oct 27, 2010
1 parent 95e7b89 commit 43dfbbd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
12 changes: 11 additions & 1 deletion features/step_definitions/rails_application_steps.rb
Expand Up @@ -294,7 +294,17 @@ def rails_non_initializer_hoptoad_config_file
end

When /^I configure the Heroku gem shim with "([^\"]*)"$/ do |api_key|
HoptoadGenerator.any_instance.stubs(:heroku_api_key).with(api_key)
heroku_script_bin = File.join(TEMP_DIR, "bin")
FileUtils.mkdir_p(heroku_script_bin)
heroku_script = File.join(heroku_script_bin, "heroku")
File.open(heroku_script, "w") do |f|
f.puts "#!/bin/sh"
f.puts "if [[ $1 == 'console' && $2 == 'puts ENV[%{HOPTOAD_API_KEY}]' ]]; then"
f.puts " echo #{api_key}"
f.puts "fi"
end
FileUtils.chmod(0755, heroku_script)
@terminal.prepend_path(heroku_script_bin)
end

When /^I configure the application to filter parameter "([^\"]*)"$/ do |parameter|
Expand Down
7 changes: 6 additions & 1 deletion features/support/terminal.rb
Expand Up @@ -32,7 +32,8 @@ def run(command)

output << "#{command}\n"
FileUtils.cd(@cwd) do
cmdline = "#{environment_settings} #{command} 2>&1"
# The ; forces ruby to shell out so the env settings work right
cmdline = "#{environment_settings} #{command} 2>&1 ; "
logger.debug(cmdline)
result = `#{cmdline}`
logger.debug(result)
Expand Down Expand Up @@ -74,6 +75,10 @@ def uninstall_gem(gem)
`gem uninstall -i #{BUILT_GEM_ROOT} #{gem}`
end

def prepend_path(path)
@environment_variables['PATH'] = path + ":" + @environment_variables['PATH']
end

private

def install_gem_to(root, gem)
Expand Down

0 comments on commit 43dfbbd

Please sign in to comment.