File: os_fixtures_spec.rb

package info (click to toggle)
ruby-device-detector 1.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 3,104 kB
  • sloc: ruby: 1,224; makefile: 5
file content (26 lines) | stat: -rw-r--r-- 650 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require_relative '../spec_helper'

describe DeviceDetector::OS do

  fixture_dir = File.expand_path('../../fixtures/parser', __FILE__)
  fixture_files = Dir["#{fixture_dir}/oss.yml"]
  fixture_files.each do |fixture_file|

    describe File.basename(fixture_file) do

      fixtures = YAML.load(File.read(fixture_file))
      fixtures.each do |f|
        user_agent = f["user_agent"]

        describe user_agent do

          it "should have the expected name" do
            os = DeviceDetector::OS.new(user_agent)
            assert_equal f["os"]["name"], os.name, "failed OS name detection"
          end

        end
      end
    end
  end
end