Bartosz Blimke RSS

Archive

Nov
1st
Sun
permalink

Solving the problem of non-working key forwarding with Capistrano

After I upgraded my Mac to Snow Leopard, Capistrano deployments with key forwarding stopped working. I started getting a following error:

Permission denied (publickey).

My fellow Bambinos enlightened me that key forwarding was switched off by default in Snow Leopard. The solution was to change the following two lines in /etc/ssh_config:

#Host *
#ForwardAgent no

to the following two lines:

Host *
ForwardAgent yes

Unfortunately after this change I was still getting Permission denied (publickey) error.

Today I found the root cause. My ssh key was not added to the authentication agent so the key was not forwarded. The solution was to execute the following command:

ssh-add ~/.ssh/id_dsa

(or ssh-add ~/.ssh/id_rsa if you use rsa key)

Now everything works fine.

Aug
22nd
Fri
permalink

How to mock Rails view helpers with RSpec

If you want to stub view helper method in some view spec, you can do the following:

 @controller.template.stub!(:helper_method_name).with(:some_args).and_return("some result")
Aug
20th
Wed
permalink
Aug
1st
Fri
permalink
permalink

How to setup God to send email notifications using Gmail

Here is, how to setup God to send email notifications using a Gmail account.

Step 1:

gem install tlsmail

Step 2:

Modify the following code and add it to your God config

—-

require ‘tlsmail’
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)

God::Contacts::Email.message_settings = {:from => ‘my_user@gmail.com’}

God::Contacts::Email.server_settings = {
:address => “smtp.gmail.com”,
:port => 587,
:user_name => “my_user@gmail.com”,
:password => “password”,
:authentication => :plain

}

—-