Skip to content

Commit

Permalink
Add a test case for bot detection with nil user agent.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnando committed Feb 27, 2018
1 parent 33faede commit 5ea7263
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/unit/bots_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ class BotsTest < Minitest::Test
assert browser.bot?
end

test "allows setting nil as user agent for bots" do
browser = Browser.new(nil)
refute browser.bot?

Browser::Bot.detect_empty_ua!
browser = Browser.new(nil)
assert browser.bot?
end

test "doesn't detect mozilla as a bot when considering empty UA" do
Browser::Bot.detect_empty_ua!
browser = Browser.new("Mozilla")
Expand Down

0 comments on commit 5ea7263

Please sign in to comment.