sbsm 1.4.8 → 1.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/History.txt +4 -0
- data/lib/sbsm/session.rb +4 -5
- data/lib/sbsm/version.rb +1 -1
- data/test/test_session.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aee853a34b97d3ab2ff7b4001c7e652d1e01c49
|
4
|
+
data.tar.gz: 0b2c1aa161689b95b35c60a01e09274df57c9533
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '097042df4c5dc65aae06155a75b52def17a5135d8b426ce0ebea531da3a5dcbbb510a01d3bc48ddc1f2d31c229d01394d7329753f71f9f30454ce4162b5763f7'
|
7
|
+
data.tar.gz: cea64d66ef58aaefcf3e6246286f61260052f8bc258100896259a2db7c00aeac6a259c0ef006257982d23b037e674499324f7761d13eb0f775843ac5c781561d
|
data/.travis.yml
CHANGED
@@ -17,9 +17,11 @@ bundler_args: --without debugger
|
|
17
17
|
rvm:
|
18
18
|
- ruby-head
|
19
19
|
- 2.2.3
|
20
|
+
- 2.4.0
|
20
21
|
- 2.3.0
|
21
22
|
matrix:
|
22
23
|
allow_failures:
|
23
24
|
# On november 1 had failure compiling the child_processes
|
24
25
|
- rvm: ruby-head
|
25
|
-
- rvm: 2.2.3
|
26
|
+
- rvm: 2.2.3 # Test for LogLevel does not work
|
27
|
+
- rvm: 2.3.0 # Test for LogLevel does not work
|
data/History.txt
CHANGED
data/lib/sbsm/session.rb
CHANGED
@@ -387,11 +387,10 @@ module SBSM
|
|
387
387
|
def info?
|
388
388
|
@state.info? if @state.respond_to?(:info?)
|
389
389
|
end
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
end
|
390
|
+
def is_crawler?
|
391
|
+
crawler_pattern = /archiver|slurp|bot|crawler|jeeves|spider|\.{6}/i
|
392
|
+
!!crawler_pattern.match(@rack_request.user_agent)
|
393
|
+
end
|
395
394
|
def language
|
396
395
|
cookie_set_or_get(:language) || default_language
|
397
396
|
end
|
data/lib/sbsm/version.rb
CHANGED
data/test/test_session.rb
CHANGED
@@ -70,6 +70,7 @@ class StubSessionValidator < SBSM::Validator
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
class StubSessionRequest < Rack::Request
|
73
|
+
attr_accessor :user_agent
|
73
74
|
def initialize(path='', params = {})
|
74
75
|
super(Rack::MockRequest.env_for("http://example.com:8080/#{path}", params))
|
75
76
|
end
|
@@ -429,4 +430,9 @@ class TestSession < Minitest::Test
|
|
429
430
|
}
|
430
431
|
assert_equal('gcc', session.flavor)
|
431
432
|
end
|
433
|
+
def test_is_crawler
|
434
|
+
@request.user_agent = 'google crawler'
|
435
|
+
@session.process_rack(rack_request: @request)
|
436
|
+
assert_equal(true, @session.is_crawler?)
|
437
|
+
end
|
432
438
|
end
|