Sha256: 9c8dc737dd30ed6aea3a16756e6a39f9de77ce3835c8e3d1604f11fc613405dc

Contents?: true

Size: 1.17 KB

Versions: 33

Compression:

Stored size: 1.17 KB

Contents

require "spec_helper"

module Beaker
  module Options
    describe HostsFileParser do

      let(:parser) {HostsFileParser}
      let(:filepath) {File.join(File.expand_path(File.dirname(__FILE__)), "data", "hosts.cfg")}

      it "can correctly read a host file" do
        FakeFS.deactivate!
        config = parser.parse_hosts_file(filepath)
        expect(config).to be === {:HOSTS=>{:"pe-ubuntu-lucid"=>{:roles=>["agent", "dashboard", "database", "master"], :vmname=>"pe-ubuntu-lucid", :platform=>"ubuntu-10.04-i386", :snapshot=>"clean-w-keys", :hypervisor=>"fusion"}, :"pe-centos6"=>{:roles=>["agent"], :vmname=>"pe-centos6", :platform=>"el-6-i386", :hypervisor=>"fusion", :snapshot=>"clean-w-keys"}}, :nfs_server=>"none", :consoleport=>443}
      end

      it "can merge CONFIG section into overall hash" do
        FakeFS.deactivate!
        config = parser.parse_hosts_file(filepath)
        expect(config['CONFIG']).to be === nil
        expect(config['consoleport']).to be === 443
      end

      it "raises an error on no file found" do
        FakeFS.deactivate!
        expect{parser.parse_hosts_file("not a valid path")}.to raise_error(ArgumentError)
      end

    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
beaker-1.16.0 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.15.0 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.14.1 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.14.0 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.13.1 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.13.0 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.12.2 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.12.1 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.12.0 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.11.2 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.11.1 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.11.0 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.10.0 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.9.1 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.9.0 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.8.2 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.8.1 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.8.0 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.7.0 spec/beaker/options/hosts_file_parser_spec.rb
beaker-1.6.2 spec/beaker/options/hosts_file_parser_spec.rb