Skip to content

Commit

Permalink
Test authentication failure help text for missing ssh keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Burkhart & Martin Emde committed Jan 12, 2011
1 parent 76ddad4 commit de6c0ac
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions spec/ey/deploy_spec.rb
@@ -1,4 +1,5 @@
require 'spec_helper'
require 'net/ssh'

describe "ey deploy without an eyrc file" do

Expand Down Expand Up @@ -50,6 +51,23 @@ def verify_ran(scenario)
describe "ey deploy" do
given "integration"

context "without ssh keys (with ssh enabled)" do
before do
ENV['NO_SSH'] = nil
Net::SSH.stub!(:start).and_raise(Net::SSH::AuthenticationFailed.new("no key"))
end

after do
ENV['NO_SSH'] = 'true'
end

it "tells you that you need to add an appropriate ssh key" do
api_scenario "one app, one environment"
fast_failing_ey ["deploy"]
@err.should include("Authentication Failed")
end
end

context "with invalid input" do
it "complains when there is no app" do
api_scenario "empty"
Expand Down
2 changes: 1 addition & 1 deletion spec/support/helpers.rb
Expand Up @@ -36,7 +36,7 @@ def fast_ey(args)
def fast_failing_ey(*args)
begin
fast_ey(*args)
raise ZeroExitStatus
raise ZeroExitStatus.new(@out, @err)
rescue SystemExit => exit_status
# SystemExit typically indicates a bogus command, which we
# here in expected-to-fail land are entirely happy with.
Expand Down

0 comments on commit de6c0ac

Please sign in to comment.