Sha256: 7b724978a2e4b6a621fedf4bd41fec92dccaec7d31f3b1286135c6e7a79fe708

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

require 'helper'

class TestCredentialsPlugin < Test::Unit::TestCase
  def app_path(relative='')
    File.expand_path(@test_app_dir + '/' + relative)
  end

  context 'credentials plugin' do
    setup do
      @pusher = Soca::Pusher.new(app_path)
      @plugin = Soca::Plugins::Credentials.new(@pusher)
    end

    if RUBY_PLATFORM =~ /darwin/i
      require 'keychain'
      context 'given keychain credentials' do
        should 'check for platform availability' do
          @plugin.expects(:credentials_supported?).
            with('KEYCHAIN_CREDENTIALS').
            returns(true)
          @plugin.after_load_couchapprc
        end

        # Note this test requires you have
        # an application password item
        # in your keychain with the
        # name localhost:5894/testapp
        # username admin
        # password admin
        should 'return username and password for host from keychain' do
          @plugin.expects(:keychain_credentials).
            with('localhost:5984/testapp').
            returns(%w[admin admin])
          @plugin.after_load_couchapprc
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
soca-0.3.3 test/test_credentials_plugin.rb
soca-0.3.2 test/test_credentials_plugin.rb