Sha256: 763a14522340241ea92c7493cd7c0fa66334e29dcf305defe2240a0e1a7c9fe7
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper' describe "Key" do it "be able to be instantiated with a keyfile" do lambda {Key.new("file")}.should_not raise_error end it "should fill in the filepath as id_rsa if no filelocation is given" do Key.new.filepath.should == "id_rsa" end it "should provide valid to_json" do lambda {Key.new("file").to_hash.to_json}.should_not raise_error end describe "that exists" do before(:each) do @keypair = "/var/home/id_rsa" ::File.stub!(:file?).with(@keypair).and_return true ::File.stub!(:expand_path).with(@keypair).and_return @keypair @key = Key.new(@keypair) end it "say that the key exists" do @key.exists?.should == true end end describe "that is not a full filepath name" do before(:each) do @keypair = "sshkey_test" Dir.stub!(:pwd).and_return "#{::File.dirname(__FILE__)}/test_plugins" Key.add_searchable_path("#{::File.dirname(__FILE__)}/test_plugins") @key = Key.new(@keypair) end it "should search in known locations for the key" do @key.should_receive(:search_in_known_locations).and_return nil @key.full_filepath end it "return the full filepath when the key exists (checking last possible Dir.pwd)" do @key.full_filepath.should =~ /sshkey_test/ end it "should return the content of the keyfile when requested" do @key.content.should == "-- THIS IS A TEST SSH KEY FILE --\n\n" end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
auser-poolparty-1.2.12 | spec/poolparty/poolparty/key_spec.rb |
fairchild-poolparty-1.2.12 | spec/poolparty/poolparty/key_spec.rb |