Sha256: 3770485ec1226e0c7c7c57906dfe1ce053a1c1a9fbfb440b7a36b69253f1a9ac

Contents?: true

Size: 1009 Bytes

Versions: 7

Compression:

Stored size: 1009 Bytes

Contents

require 'spec_helper'

require 'vagrant-hosts/config'

describe VagrantHosts::Config do
  let(:machine)  { double('machine') }

  describe 'hosts' do
    it 'requires aliases to be an array' do
      subject.add_host '127.0.0.1', 'local.server'
      subject.finalize!

      errors = subject.validate(machine)

      expect(errors['Vagrant Hosts'].to_s).to match(/should have an array of aliases/)
    end

    it 'accepts an array of aliases' do
      subject.add_host '127.0.0.1', ['local.server']
      subject.finalize!

      errors = subject.validate(machine)

      expect(errors['Vagrant Hosts']).to eq []
    end

    it 'can be merged' do
      subject.add_host '127.0.0.1', ['local.server']
      subject.finalize!

      other = described_class.new
      other.add_host '10.0.20.1', ['other.server']
      other.finalize!

      result = subject.merge(other)

      expect(result.hosts).to eq [
        ["127.0.0.1", ["local.server"]],
        ["10.0.20.1", ["other.server"]]]
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vagrant-hosts-2.8.1 spec/unit/config_spec.rb
vagrant-hosts-2.8.0 spec/unit/config_spec.rb
vagrant-hosts-2.7.1 spec/unit/config_spec.rb
vagrant-hosts-2.7.0 spec/unit/config_spec.rb
vagrant-hosts-2.6.2 spec/unit/config_spec.rb
vagrant-hosts-2.6.1 spec/unit/config_spec.rb
vagrant-hosts-2.6.0 spec/unit/config_spec.rb