Sha256: 7f5851fa007d8775735a38459423939b346bf452ac747886cfa2f55de7ce1b6c

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

require 'rbfs/host'

describe Rbfs::Host do
  def test_example(line, ip, name=nil, alias_name=nil)
    host = Rbfs::Host.new(line)
    host.ip.should eql(ip)
    host.name.should eql(name)
    host.alias.should eql(alias_name)
  end

  it "should handle minimal syntax" do
    test_example("1.1.1.1", "1.1.1.1")
  end

  it "should handle basic syntax" do
    test_example("1.1.1.1 HOSTNAME", "1.1.1.1", "HOSTNAME")
  end

  it "should handle advanced syntax" do
    test_example("1.1.1.1 HOSTNAME HOST", "1.1.1.1", "HOSTNAME", "HOST")
  end

  it "should support tab separation" do
    test_example("1.1.1.1\tHOSTNAME", "1.1.1.1", "HOSTNAME")
  end

  it "should tolerate lots of tab separation" do
    test_example("1.1.1.1\t\t\t\t\t\t\tHOSTNAME", "1.1.1.1", "HOSTNAME")
  end

  it "should tolerate lots of spaces" do
    test_example("1.1.1.1        HOSTNAME", "1.1.1.1", "HOSTNAME")
  end

  it "should tolerate lots of aliases" do
    test_example("1.1.1.1 HOSTNAME HOSTA HOSTB HOSTC HOSTD", "1.1.1.1", "HOSTNAME", "HOSTA")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rbfs-0.0.10 spec/rbfs/host_spec.rb
rbfs-0.0.9 spec/rbfs/host_spec.rb
rbfs-0.0.8 spec/rbfs/host_spec.rb
rbfs-0.0.7 spec/rbfs/host_spec.rb
rbfs-0.0.6 spec/rbfs/host_spec.rb
rbfs-0.0.5 spec/rbfs/host_spec.rb
rbfs-0.0.4 spec/rbfs/host_spec.rb
rbfs-0.0.3 spec/rbfs/host_spec.rb