Sha256: 0109eb07b821e3b520879292362deaf13c0e38ecd8bd4ee0cb814514e0682bd8

Contents?: true

Size: 1.16 KB

Versions: 21

Compression:

Stored size: 1.16 KB

Contents

module ClientHelpers

  def self.included(base)
    base.let(:subject) do
      described_class.new(File.basename($0))
    end

    base.let(:client) do
      spy(:client)
    end

    base.let(:token) do
      '1234567'
    end

    base.let(:settings) do
      {'current_server' => 'alias',
       'current_account' => 'kontena',
       'servers' => [
           {'name' => 'some_master', 'url' => 'some_master'},
           {'name' => 'alias', 'url' => 'someurl', 'token' => token, 'account' => 'master'}
       ]
      }
    end

    base.before(:each) do
      RSpec::Mocks.space.proxy_for(File).reset
      allow(subject).to receive(:client).and_return(client)
      allow(subject).to receive(:current_grid).and_return('test-grid')
      allow(File).to receive(:exist?).with(File.join(Dir.home, '.kontena_client.json')).and_return(true)
      allow(File).to receive(:readable?).with(File.join(Dir.home, '.kontena_client.json')).and_return(true)
      allow(File).to receive(:read).and_call_original
      allow(File).to receive(:read).with(File.join(Dir.home, '.kontena_client.json')).and_return(JSON.dump(settings))
      Kontena::Cli::Config.reset_instance
    end
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
kontena-cli-0.16.3 spec/support/client_helpers.rb
kontena-cli-0.16.3.rc1 spec/support/client_helpers.rb
kontena-cli-0.16.2 spec/support/client_helpers.rb
kontena-cli-0.16.2.rc1 spec/support/client_helpers.rb
kontena-cli-0.16.1 spec/support/client_helpers.rb
kontena-cli-0.16.1.rc3 spec/support/client_helpers.rb
kontena-cli-0.16.1.rc2 spec/support/client_helpers.rb
kontena-cli-0.16.1.rc1 spec/support/client_helpers.rb
kontena-cli-0.16.0 spec/support/client_helpers.rb
kontena-cli-0.16.0.rc3 spec/support/client_helpers.rb
kontena-cli-0.16.0.rc2 spec/support/client_helpers.rb
kontena-cli-0.16.0.rc1 spec/support/client_helpers.rb
kontena-cli-0.16.0.pre9 spec/support/client_helpers.rb
kontena-cli-0.16.0.pre8 spec/support/client_helpers.rb
kontena-cli-0.16.0.pre7 spec/support/client_helpers.rb
kontena-cli-0.16.0.pre6 spec/support/client_helpers.rb
kontena-cli-0.16.0.pre5 spec/support/client_helpers.rb
kontena-cli-0.16.0.pre4 spec/support/client_helpers.rb
kontena-cli-0.16.0.pre3 spec/support/client_helpers.rb
kontena-cli-0.16.0.pre2 spec/support/client_helpers.rb