Sha256: d5bd12db218d935cf2950e154fbe4ef81ef949745383cf58f69d9c45a3828b66

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe UseragentParser do
  let(:user_agent_string) { 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; fr; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5,gzip(gfe),gzip(gfe)' }

  describe "should return user agent information" do
    subject { UseragentParser.parse_browser(user_agent_string)['user_agent'] }

    its(['family']) { should == 'Firefox' }
    its(['major']) { should == '3' }
    its(['minor']) { should == '5' }
    its(['patch']) { should == '5' }
  end

  describe "should return the operating system information" do
    subject { UseragentParser.parse_browser(user_agent_string)['os'] }

    its(['family']) { should == 'Mac OS X' }
    its(['major']) { should == '10' }
    its(['minor']) { should == '4' }
    its(['patch']) { should be_nil }
    its(['patch_minor']) { should be_nil }
  end

  describe "should return the device information" do
    subject { UseragentParser.parse_browser(user_agent_string)['device'] }

    its(['family']) { should be_nil }
    its(['is_spider']) { should be_false }
    its(['is_mobile']) { should be_false }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
useragent_parser-0.2.2 spec/useragent_parser_spec.rb
useragent_parser-0.2.1 spec/useragent_parser_spec.rb
useragent_parser-0.2.0 spec/useragent_parser_spec.rb