Skip to content

Commit

Permalink
GH #15: mock actual failure when no local ssh-keys found
Browse files Browse the repository at this point in the history
  • Loading branch information
cldwalker committed Apr 5, 2012
1 parent 7d1f491 commit 6dfb149
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions spec/lib/provision_config_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
subject { ProvisionConfigGenerator.new(['name']) }

it "aborts if no ssh-keys are found" do
subject.should_receive(:fetch_keys).and_return([])
msg = "No ssh keys were found! Check ssh-add -L and your keys_git_url config."
should_abort_with(msg) do
subject.should_receive(:`).and_return do
system('exit 1')
# Actual message that comes back from failed call
'The agent has no entities'
end
RelevanceRails::PublicKeyFetcher.should_receive(:public_keys).and_return([])

should_abort_with(/^No ssh keys were found!/) do
subject.create_authorized_key_data_bag
end
end
Expand Down

0 comments on commit 6dfb149

Please sign in to comment.