woothee 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/woothee/version.rb +1 -1
- data/lib/woothee.rb +1 -1
- data/spec/02_run_testsets_spec.rb +11 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c014eaeb7dddd4ad586f76066fdadb6c0585cdef
|
4
|
+
data.tar.gz: 61bb29e14c857fe716a04144ce0bb53b061b48d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef8c6a020c0712bbb2b3560a01458cc40ddd0b2d2ea2aacc9f5073e4e95986f3a7efc9215d06df09cd78397004635802b7a7612c7457ff4b8baae5b0b1db0d12
|
7
|
+
data.tar.gz: 3cc4730be55cde4d26c537bf75c81d9751bfb6b82e8de1d5b3645212bacd4adac7feae84e5530d14db6e843107782fd3056426ddb89658661c817691b7526593
|
data/lib/woothee/version.rb
CHANGED
data/lib/woothee.rb
CHANGED
@@ -16,7 +16,7 @@ module Woothee
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.is_crawler(useragent)
|
19
|
-
useragent.length > 0 and useragent != '-' and try_crawler(useragent, {})
|
19
|
+
!!useragent && useragent.length > 0 and useragent != '-' and try_crawler(useragent, {})
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.exec_parse(useragent)
|
@@ -26,12 +26,19 @@ describe Woothee do
|
|
26
26
|
TARGETS.each do |filename,groupname|
|
27
27
|
YAML.load_file(TESTSET_DIR + filename).each do |e|
|
28
28
|
r = Woothee.parse(e['target'])
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
context groupname do
|
30
|
+
[:name, :category, :os, :version, :vendor, :os_version].each do |attribute|
|
31
|
+
it ("test(%s): %s" % [attribute, e['target']]) do
|
32
|
+
if [:name, :category].include?(attribute) or ([:os, :version, :vendor, :os_version].include?(attribute) and e.has_key?(attribute.to_s))
|
33
|
+
expect(r[attribute].to_s).to eql(e[attribute.to_s])
|
34
|
+
end
|
33
35
|
end
|
34
36
|
end
|
37
|
+
|
38
|
+
it "test(is_crawler): #{e['target']}" do
|
39
|
+
is_major_crawler = e['category'] == 'crawler' && e['name'] != 'misc crawler'
|
40
|
+
expect(Woothee.is_crawler(e['target'])).to eq(is_major_crawler)
|
41
|
+
end
|
35
42
|
end
|
36
43
|
end
|
37
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: woothee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAGOMORI Satoshi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|