Skip to content

Commit

Permalink
Merge pull request #113 from podigee/fg/add-spec-for-nil-user-agent
Browse files Browse the repository at this point in the history
Add specs for nil user_agent
  • Loading branch information
spiderpug authored Aug 4, 2023
2 parents 3a6e495 + 7810561 commit d3687b1
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions spec/device_detector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,52 @@
end
end

describe 'user agent is nil' do
let(:user_agent) { nil }

describe '#name' do
it 'returns nil' do
value(client.name).must_be_nil
end
end

describe '#full_version' do
it 'returns nil' do
value(client.full_version).must_be_nil
end
end

describe '#os_name' do
it 'returns nil' do
value(client.os_name).must_be_nil
end
end

describe '#os_full_version' do
it 'returns nil' do
value(client.os_full_version).must_be_nil
end
end

describe '#known?' do
it 'returns false' do
value(client.known?).must_equal false
end
end

describe '#bot?' do
it 'returns false' do
value(client.bot?).must_equal false
end
end

describe '#bot_name' do
it 'returns nil' do
value(client.bot_name).must_be_nil
end
end
end

describe 'wrongly encoded user agent' do
let(:user_agent) { 'Mon User-Agent personnalisé'.dup.force_encoding('ASCII-8BIT') }

Expand Down

0 comments on commit d3687b1

Please sign in to comment.