Sha256: 3f3ec8801976a6c86d7021de38fe51f1b62711e0792d7c355f8ddd9a35d5cc44

Contents?: true

Size: 1.47 KB

Versions: 19

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'
require 'keyring_liberator'
require 'tmpdir'
require 'keyring'

include CocoaPodsKeys

describe KeyringLiberator do
  it 'should get the keys directory' do
    expect(KeyringLiberator.keys_dir.to_s).to end_with('cocoapods/keys')
  end

  it 'should append a sha + .yaml when getting the yaml path' do
    expect(KeyringLiberator.yaml_path_for_path('test').to_s).to include('cocoapods/keys/')
    expect(KeyringLiberator.yaml_path_for_path('test').to_s).to end_with('098f6bcd4621d373cade4e832627b4f6.yml')
  end

  it 'should find by name' do
    keyring = Keyring.from_hash('name' => 'test', 'path' => 'testpath', 'keys' => [])
    allow(KeyringLiberator).to receive(:get_all_keyrings).and_return([keyring])
    expect(KeyringLiberator.get_keyring_named('test')).to equal(keyring)
  end

  it 'should find many by name' do
    keyring1 = Keyring.from_hash('name' => 'test', 'path' => 'testpath1', 'keys' => [])
    keyring2 = Keyring.from_hash('name' => 'test', 'path' => 'testpath2', 'keys' => [])
    allow(KeyringLiberator).to receive(:get_all_keyrings).and_return([keyring1, keyring2])
    expect(KeyringLiberator.get_all_keyrings_named('test')).to eq([keyring1, keyring2])
  end

  it 'should be nil if nothing found find by name' do
    keyring = Keyring.from_hash('name' => 'test', 'path' => 'testpath', 'keys' => [])
    allow(KeyringLiberator).to receive(:get_all_keyrings).and_return([keyring])
    expect(KeyringLiberator.get_keyring_named('not found')).to be_falsey
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
cocoapods-keys-2.3.1 spec/keyring_liberator_spec.rb
cocoapods-keys-2.3.0 spec/keyring_liberator_spec.rb
cocoapods-keys-2.2.1 spec/keyring_liberator_spec.rb
cocoapods-keys-2.2.0 spec/keyring_liberator_spec.rb
cocoapods-keys-2.1.0 spec/keyring_liberator_spec.rb
cocoapods-keys-2.0.7 spec/keyring_liberator_spec.rb
cocoapods-keys-2.0.6 spec/keyring_liberator_spec.rb
cocoapods-keys-2.0.5 spec/keyring_liberator_spec.rb
cocoapods-keys-2.0.4 spec/keyring_liberator_spec.rb
cocoapods-keys-2.0.3 spec/keyring_liberator_spec.rb
cocoapods-keys-2.0.2 spec/keyring_liberator_spec.rb
cocoapods-keys-2.0.1 spec/keyring_liberator_spec.rb
cocoapods-keys-2.0.0 spec/keyring_liberator_spec.rb
cocoapods-keys-1.7.0 spec/keyring_liberator_spec.rb
cocoapods-keys-1.6.1 spec/keyring_liberator_spec.rb
cocoapods-keys-1.6.0 spec/keyring_liberator_spec.rb
cocoapods-keys-1.5.2 spec/keyring_liberator_spec.rb
cocoapods-keys-1.5.1 spec/keyring_liberator_spec.rb
cocoapods-keys-1.5.0 spec/keyring_liberator_spec.rb