Permalink
Browse files

Fix shell command and update tests for Windows

  • Loading branch information...
1 parent 13341d4 commit a2ecd8a3b64ecdb6d4edfeb7352e8da701926b24 @rubyworkshop rubyworkshop committed May 24, 2009
Showing with 5 additions and 5 deletions.
  1. +1 −1 lib/heroku/commands/base.rb
  2. +4 −4 spec/commands/auth_spec.rb
@@ -28,7 +28,7 @@ def ask
end
def shell(cmd)
- `cd '#{Dir.pwd}' && #{cmd}`
+ FileUtils.cd(Dir.pwd) {|d| return `#{cmd}`}
end
def heroku
@@ -7,7 +7,7 @@ module Heroku::Command
end
it "reads credentials from the credentials file" do
- sandbox = "/tmp/cli_spec_#{Process.pid}"
+ sandbox = "#{Dir.tmpdir}/cli_spec_#{Process.pid}"
File.open(sandbox, "w") { |f| f.write "user\npass\n" }
@cli.stub!(:credentials_file).and_return(sandbox)
@cli.read_credentials.should == %w(user pass)
@@ -20,7 +20,7 @@ module Heroku::Command
end
it "asks for credentials when the file doesn't exist" do
- sandbox = "/tmp/cli_spec_#{Process.pid}"
+ sandbox = "#{Dir.tmpdir}/cli_spec_#{Process.pid}"
FileUtils.rm_rf(sandbox)
@cli.stub!(:credentials_file).and_return(sandbox)
@cli.should_receive(:ask_for_credentials).and_return([ 'u', 'p'])
@@ -29,7 +29,7 @@ module Heroku::Command
end
it "writes the credentials to a file" do
- sandbox = "/tmp/cli_spec_#{Process.pid}"
+ sandbox = "#{Dir.tmpdir}/cli_spec_#{Process.pid}"
FileUtils.rm_rf(sandbox)
@cli.stub!(:credentials_file).and_return(sandbox)
@cli.stub!(:credentials).and_return(['one', 'two'])
@@ -39,7 +39,7 @@ module Heroku::Command
end
it "sets ~/.heroku/credentials to be readable only by the user" do
- sandbox = "/tmp/cli_spec_#{Process.pid}"
+ sandbox = "#{Dir.tmpdir}/cli_spec_#{Process.pid}"
FileUtils.rm_rf(sandbox)
FileUtils.mkdir_p(sandbox)
fname = "#{sandbox}/file"

0 comments on commit a2ecd8a

Please sign in to comment.