Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Next release
* Gecko: Return `Android` instead of `Android 8.0.0` for `user_agent.platform` when the version of the Android is given
2 changes: 2 additions & 0 deletions lib/user_agent/browsers/gecko.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def platform
nil
elsif /^Windows / =~ comment[0]
'Windows'
elsif comment.any? { |c| c =~ /Android/ }
'Android'
else
comment[0]
end
Expand Down
20 changes: 20 additions & 0 deletions spec/browsers/gecko_user_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,26 @@
end
end

describe 'Mozilla/5.0 (Android 8.0.0; Mobile; rv:66.0) Gecko/66.0 Firefox/66.0' do
before do
@useragent = UserAgent.parse('Mozilla/5.0 (Android 8.0.0; Mobile; rv:66.0) Gecko/66.0 Firefox/66.0')
end

it_behaves_like 'Firefox browser'

it 'returns true for mobile?' do
expect(@useragent.mobile?).to be true
end

it "returns 'Android' as the platform" do
expect(@useragent.platform).to eq('Android')
end

it "returns 'Android 8.0.0' as the operating system" do
expect(@useragent.os).to eq('Android 8.0.0')
end
end

describe 'Mozilla/5.0 (Mobile; rv:41.0) Gecko/41.0 Firefox/41.0' do
before do
@useragent = UserAgent.parse('Mozilla/5.0 (Mobile; rv:41.0) Gecko/41.0 Firefox/41.0')
Expand Down