Sha256: 00b422c6e97d59afd476337e49c2c9a7665e5eeaa6c6dacae53feccceba90e69

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe SetecAstronomy::KeePass::Database do
  describe 'self.open' do
    it "creates a new instance of the databse with the file" do
      db = SetecAstronomy::KeePass::Database.open(TEST_DATABASE_PATH)
      db.should_not be_nil
    end
  end

  describe "unlock" do
    before :each do
      @db = SetecAstronomy::KeePass::Database.open(TEST_DATABASE_PATH)
      @db.should be_valid
    end

    it "returns true when the master password is correct" do
      @db.unlock('testmasterpassword').should be_true
    end

    it "returns false when the master password is incorrect" do
      @db.unlock('bad password').should be_false
    end
  end

  describe "an unlocked database" do
    before :each do
      @db = SetecAstronomy::KeePass::Database.open(TEST_DATABASE_PATH)
      @db.unlock('testmasterpassword')
    end

    it "can find entries by their title" do
      @db.entry("test entry").password.should == "testpassword"
    end

    it "can find groups" do
      @db.groups.map(&:name).sort.should == ["Internet", "eMail"]
    end

    it "can search for entries" do
      entries = @db.search "test"
      entries.first.title.should == "test entry"
    end

    it "can search for entries case-insensitively" do
      entries = @db.search "TEST"
      entries.first.title.should == "test entry"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
setec_astronomy-0.2.1 spec/kee_pass/database_spec.rb
setec_astronomy-0.2.0 spec/kee_pass/database_spec.rb