Permalink
Browse files

missing tests and style changes for last pull request

  • Loading branch information...
1 parent eb2ccbe commit 17a0a961ffe44d1c811d46f9f3d0272242331589 @wbailey committed Jun 1, 2012
Showing with 23 additions and 11 deletions.
  1. +5 −11 lib/claws/command/ec2.rb
  2. +18 −0 spec/configuration_spec.rb
View
@@ -34,19 +34,13 @@ def self.exec(options)
puts 'connecting to server...'
identity = config.ssh.identity.nil? ? '' : "-i #{config.ssh.identity}"
- current_instance = instances[selection.to_i]
- ssh_opts = {:identity => identity, :ssh_user => config.ssh.user}
- if instances[selection.to_i].vpc?
- ssh(ssh_opts.merge(:host => current_instance.private_ip_address))
- else
- ssh(ssh_opts.merge(:host => current_instance.dns_name))
- end
- end
- end
+ instance = instances[selection.to_i]
+
+ hostname = instance.vpc? ? instance.private_ip_address : instance.dns_name
- def self.ssh(opts={})
- system "ssh #{opts[:identity]} #{opts[:ssh_user]}@#{opts[:host]}"
+ system "ssh #{identity} #{config.ssh.user}@#{hostname}"
+ end
end
end
end
View
@@ -7,6 +7,10 @@
'capistrano' => {
'home' => 'test',
},
+ 'ssh' => {
+ 'user' => 'test',
+ 'identity' => 'test/id_rsa',
+ },
'aws' => {
'access_key_id' => 'asdf',
'secret_access_key' => 'qwer',
@@ -61,6 +65,20 @@
end
end
+ context 'SSH' do
+ before :each do
+ YAML.should_receive(:load_file).and_return(yaml)
+ end
+
+ it 'defines user' do
+ config.ssh.user.should == 'test'
+ end
+
+ it 'defines the identity file' do
+ config.ssh.identity.should == 'test/id_rsa'
+ end
+ end
+
context 'AWS' do
before :each do
YAML.should_receive(:load_file).and_return(yaml)

0 comments on commit 17a0a96

Please sign in to comment.