Sha256: 2e2ef7035be2c49064501a184e3d4994b8e70b6b1848ccfcb795aadfb8fc2a64

Contents?: true

Size: 703 Bytes

Versions: 8

Compression:

Stored size: 703 Bytes

Contents

require 'rbfs/host_parser'
require 'stringio'

describe Rbfs::HostParser do
  def test_case(string, size)
    io = StringIO.new(string)
    hp = Rbfs::HostParser.new(io)
    hp.collect {|v|v}.length.should eql(size)
  end

  it "should handle a file with only comments" do
    test_case("# TEST", 0)
  end

  it "should handle a file with one host" do
    test_case("1.1.1.1 HOSTNAME", 1)
  end

  it "should handle a basic file" do
    test_case("# TEST\n1.1.1.1 HOSTNAME", 1)
  end

  it "should handle empty lines" do
    test_case("\n\n# TEST\n1.1.1.1 HOSTNAME\n\n", 1)
  end

  it "should handle multiple lines" do
    test_case("1.1.1.1 HOSTNAME\n1.1.1.1 HOSTNAME\n1.1.1.1 HOSTNAME", 3)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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