spec/key_master_spec.rb in cocoapods-keys-1.4.0 vs spec/key_master_spec.rb in cocoapods-keys-1.5.0

- old
+ new

@@ -1,9 +1,12 @@ require 'spec_helper' +require 'keyring' require 'key_master' require 'tmpdir' +include CocoaPodsKeys + describe CocoaPodsKeys::KeyMaster do # Previous tests operated under assumption that # empty keychains were OK. See for more info: # github.com/orta/cocoapods-keys/pull/68 @@ -19,8 +22,23 @@ m_file = File.join(dir, "#{keymaster.name}.m") IO.write(m_file, keymaster.implementation) # attempt to validate syntax with clang Dir.chdir(dir) system(`xcrun --sdk macosx --find clang`.strip, '-fsyntax-only', m_file) + end + end + + describe '#name' do + it 'takes keyring with name that starts with number returns augmented the name with underscore' do + keyring = Keyring.new('500px', '/', ['ARMyKey']) + keyring.instance_variable_set(:@keychain, FakeKeychain.new('ARMyKey' => 'secretkey')) + key_master = KeyMaster.new(keyring) + expect(key_master.name).to eq('_500pxKeys') + end + it 'takes keyring with proper name returns proper Keys file' do + keyring = Keyring.new('Artsy', '/', ['ARMyKey']) + keyring.instance_variable_set(:@keychain, FakeKeychain.new('ARMyKey' => 'secretkey')) + key_master = KeyMaster.new(keyring) + expect(key_master.name).to eq('ArtsyKeys') end end end