rack-turing-test 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1 +1,9 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec) do |t|
5
+ t.fail_on_error = false
6
+ t.rspec_opts = "--color"
7
+ end
8
+
9
+ task :default => :spec
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module TuringTest
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -14,6 +14,7 @@ module Rack
14
14
  /baidu/i,
15
15
  /yetibot/i,
16
16
  /teoma/i,
17
+ /spider/i,
17
18
  ]).freeze
18
19
 
19
20
  # Returns true if the request came from bot.
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
22
+ s.add_development_dependency "rspec"
23
23
  # s.add_runtime_dependency "rest-client"
24
24
  end
@@ -0,0 +1,17 @@
1
+ require File.join(File.dirname(__FILE__), %w[.. lib rack-turing-test])
2
+ require 'rspec'
3
+
4
+ describe Rack::TuringTest do
5
+ class TestRequest
6
+ include Rack::TuringTest
7
+
8
+ def initialize(ua) @ua = ua end
9
+ def user_agent; @ua end
10
+ end
11
+
12
+ it "should detect New-Sogou-Spider as a bot" do
13
+ ua = "New-Sogou-Spider/1.0 (compatible; MSIE 5.5; Windows 98)"
14
+ req = TestRequest.new ua
15
+ req.should be_bot
16
+ end
17
+ end
metadata CHANGED
@@ -1,33 +1,39 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rack-turing-test
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Genki Takiuchi
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-22 00:00:00 Z
19
- dependencies: []
20
-
12
+ date: 2013-04-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
21
30
  description: You can test if sender of request has intelligence.
22
- email:
31
+ email:
23
32
  - genki@s21g.com
24
33
  executables: []
25
-
26
34
  extensions: []
27
-
28
35
  extra_rdoc_files: []
29
-
30
- files:
36
+ files:
31
37
  - .gitignore
32
38
  - Gemfile
33
39
  - README.md
@@ -35,39 +41,30 @@ files:
35
41
  - lib/rack-turing-test.rb
36
42
  - lib/rack-turing-test/version.rb
37
43
  - rack-turing-test.gemspec
38
- homepage: ""
44
+ - spec/rack_turing_test_spec.rb
45
+ homepage: ''
39
46
  licenses: []
40
-
41
47
  post_install_message:
42
48
  rdoc_options: []
43
-
44
- require_paths:
49
+ require_paths:
45
50
  - lib
46
- required_ruby_version: !ruby/object:Gem::Requirement
51
+ required_ruby_version: !ruby/object:Gem::Requirement
47
52
  none: false
48
- requirements:
49
- - - ">="
50
- - !ruby/object:Gem::Version
51
- hash: 3
52
- segments:
53
- - 0
54
- version: "0"
55
- required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
58
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
64
63
  requirements: []
65
-
66
64
  rubyforge_project: rack-turing-test
67
- rubygems_version: 1.8.6
65
+ rubygems_version: 1.8.24
68
66
  signing_key:
69
67
  specification_version: 3
70
68
  summary: Bot detector for Rack::Request
71
- test_files: []
72
-
73
- has_rdoc:
69
+ test_files:
70
+ - spec/rack_turing_test_spec.rb