Sha256: 1b15018734035d2b3eb9ff4ddf937bcece363658d7cbe0f0eb2e69df0829fd82

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

# Copyright (C) 2013 Dmitry Yakimenko (detunized@gmail.com).
# Licensed under the terms of the MIT license. See LICENCE for details.

require "spec_helper"
require "test_data"

describe LastPass::Vault do
    let(:vault) {
        LastPass::Vault.new LastPass::Blob.new(TEST_BLOB, TEST_KEY_ITERATION_COUNT, nil),
                            TEST_ENCRYPTION_KEY
    }

    describe ".new" do
        it "raises an exception on trucated blob" do
            [1, 2, 3, 4, 5, 10, 100, 1000].each do |i|
                expect {
                    blob = TEST_BLOB[0..(-1 - i)]
                    LastPass::Vault.new LastPass::Blob.new(blob, TEST_KEY_ITERATION_COUNT, nil),
                                        TEST_ENCRYPTION_KEY
                }.to raise_error LastPass::InvalidResponseError, "Blob is truncated"
            end
        end
    end

    describe "#accounts" do
        context "returned accounts" do
            it { expect(vault.accounts).to be_instance_of Array }

            it "should have correct IDs" do
                expect(vault.accounts.map &:id).to eq TEST_ACCOUNTS.map &:id
            end
        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lastpass-1.6.1 spec/vault_spec.rb
lastpass-1.6.0 spec/vault_spec.rb