Sha256: 43ebbb23585f98177f725832b3228ce8c4d2ed3a34f1012c07edfe2340412f5b

Contents?: true

Size: 1.45 KB

Versions: 236

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

def set_stub_chain(keys, value)
    allow(Specinfra).to receive_message_chain([:configuration, keys].flatten).and_return(value)
end

describe 'no ssh connection without cache' do
  before do
    property[:os] = nil
    set_stub_chain(:ssh, nil)
    set_stub_chain(:ssh_options, nil)
    set_stub_chain(:host, 'localhost')
    set_stub_chain(:os, :family => 'redhat')
  end

  it { expect(os[:family]).to eq 'redhat' }
end

describe 'no ssh connection with cache' do
  it { expect(property[:os]).to eq(:family => 'redhat') }
end

describe 'ssh_options without cache' do
  before do
    property[:os] = nil
    set_stub_chain(:ssh, nil)
    set_stub_chain(:ssh_options, :port => 22)
    set_stub_chain(:host, 'localhost')
    set_stub_chain(:os, :family => 'ubuntu')
  end

  it { expect(os[:family]).to eq 'ubuntu' }
end

describe 'ssh_options with cache' do
  it { expect(property[:os]).to eq(:family => 'ubuntu') }
end

describe 'ssh_connection without cache' do
  before do
    property[:os] = nil
    set_stub_chain([:ssh, :host], 'localhost')
    set_stub_chain([:ssh, :options], :port => 2222)
    set_stub_chain(:os, :family => 'nixos')
  end

  it { expect(os[:family]).to eq 'nixos' }
end

describe 'ssh_connection wit cache' do
  before do
    set_stub_chain([:ssh, :host], 'localhost')
    set_stub_chain([:ssh, :options], :port => 2222)
    set_stub_chain(:os, :family => 'nixos')
  end

  it { expect(property[:os]).to eq(:family => 'nixos') }
end

Version data entries

236 entries across 236 versions & 3 rubygems

Version Path
specinfra-rb19-2.44.7 spec/helper/os_spec.rb
specinfra-2.59.0 spec/helper/os_spec.rb
specinfra-2.58.0 spec/helper/os_spec.rb
specinfra-2.57.5 spec/helper/os_spec.rb
specinfra-2.57.4 spec/helper/os_spec.rb
specinfra-2.57.3 spec/helper/os_spec.rb
specinfra-2.57.2 spec/helper/os_spec.rb
specinfra-2.57.1 spec/helper/os_spec.rb
specinfra-cisco-2.41.0 spec/helper/os_spec.rb
specinfra-2.57.0 spec/helper/os_spec.rb
specinfra-2.56.1 spec/helper/os_spec.rb
specinfra-2.56.0 spec/helper/os_spec.rb
specinfra-2.55.0 spec/helper/os_spec.rb
specinfra-2.54.2 spec/helper/os_spec.rb
specinfra-2.54.1 spec/helper/os_spec.rb
specinfra-2.54.0 spec/helper/os_spec.rb
specinfra-2.53.1 spec/helper/os_spec.rb
specinfra-2.53.0 spec/helper/os_spec.rb
specinfra-2.52.0 spec/helper/os_spec.rb
specinfra-2.51.2 spec/helper/os_spec.rb