hosts_file 0.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/hosts_file/version.rb +1 -1
- data/spec/hosts_file/parser_spec.rb +22 -8
- metadata +7 -7
data/lib/hosts_file/version.rb
CHANGED
@@ -8,19 +8,33 @@ describe HostsFile::Parser do
|
|
8
8
|
host.aliases.should eql(alias_name)
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def test_case(string, size)
|
12
|
+
hp = HostsFile::Parser.new(string)
|
13
|
+
hp.collect {|v|v}.length.should eql(size)
|
14
14
|
end
|
15
15
|
|
16
|
-
it "should
|
17
|
-
|
18
|
-
|
16
|
+
it "should handle a file with only comments" do
|
17
|
+
test_case("# TEST", 0)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should handle a file with one host" do
|
21
|
+
test_case("1.1.1.1 HOSTNAME", 1)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should handle a basic file" do
|
25
|
+
test_case("# TEST\n1.1.1.1 HOSTNAME", 1)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should handle empty lines" do
|
29
|
+
test_case("\n\n# TEST\n1.1.1.1 HOSTNAME\n\n", 1)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should handle multiple lines" do
|
33
|
+
test_case("1.1.1.1 HOSTNAME\n1.1.1.1 HOSTNAME\n1.1.1.1 HOSTNAME", 3)
|
19
34
|
end
|
20
35
|
|
21
36
|
it "should not parse invalid lines" do
|
22
|
-
|
23
|
-
@parser.collect {|h| h}.length.should eql(0)
|
37
|
+
test_case("1.1.1.1\n", 0)
|
24
38
|
end
|
25
39
|
|
26
40
|
it "should handle basic syntax" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hosts_file
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-07-24 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &19173460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.3'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *19173460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &19172800 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *19172800
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &19171900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *19171900
|
47
47
|
description:
|
48
48
|
email:
|
49
49
|
- jbussdieker@gmail.com
|