require File.dirname(__FILE__) + '/../spec_helper.rb' describe User do before :each do @user = User.new(:name => 'bob') end it "should merge multiple keys into the authorized_keys file" do user = User.create key1 = 'this is' key2 = ' a key.' user.keys.create(:public_key => key1) user.keys.create(:public_key => key2) user.authorized_keys_file.should == key1 + key2 end it "should raise an error if the authorized_keys_file is blank" do lambda { @user.authorized_keys_file }.should raise_error end it "can generate the user's home directory path" do @user.home_directory_path.should == '/home/bob/' end it "can generate the path to the user's .ssh directory" do @user.ssh_config_directory_path.should == '/home/bob/.ssh/' end it "can generate the path to the user's authorized_keys file" do @user.authorized_keys_file_path.should == '/home/bob/.ssh/authorized_keys' end end