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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27a8d0b1a8d5a09b9528c9cf9d7257a117c7c2c1
4
- data.tar.gz: 5c277d4b25b6e834f06feae8feccf67183ef4c50
3
+ metadata.gz: c014eaeb7dddd4ad586f76066fdadb6c0585cdef
4
+ data.tar.gz: 61bb29e14c857fe716a04144ce0bb53b061b48d7
5
5
  SHA512:
6
- metadata.gz: d72ebc71e88a85f2a73bcb813bed6b62a38c30ca7eedff4442ca5251b350481dd7fadc3f82e962aa6a608852c089ea14db22a9fabeda9cdb1d00ee4034ca54f1
7
- data.tar.gz: a035060f6c2b6d2660a906732f317fd8d7c5fdda9c54cd8c60e6c99f0a3ab123b0fc6fcb606d7b2567aad3e3674ba90d489f85d1957349b2679e8ed19b867ba7
6
+ metadata.gz: ef8c6a020c0712bbb2b3560a01458cc40ddd0b2d2ea2aacc9f5073e4e95986f3a7efc9215d06df09cd78397004635802b7a7612c7457ff4b8baae5b0b1db0d12
7
+ data.tar.gz: 3cc4730be55cde4d26c537bf75c81d9751bfb6b82e8de1d5b3645212bacd4adac7feae84e5530d14db6e843107782fd3056426ddb89658661c817691b7526593
@@ -1,3 +1,3 @@
1
1
  module Woothee
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
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
- [:name, :category, :os, :version, :vendor, :os_version].each do |attribute|
30
- it groupname + ("test(%s): %s" % [attribute, e['target']]) do
31
- if [:name, :category].include?(attribute) or ([:os, :version, :vendor, :os_version].include?(attribute) and e.has_key?(attribute.to_s))
32
- expect(r[attribute].to_s).to eql(e[attribute.to_s])
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.0
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-03-01 00:00:00.000000000 Z
11
+ date: 2015-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake