Sha256: 92c815b013f3c161f52aab50f11ebec594dc3095647c577716d93b183ab9b149

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 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_all(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_all(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_all(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

2 entries across 2 versions & 1 rubygems

Version Path
useragent_parser-0.1.1 spec/useragent_parser_spec.rb
useragent_parser-0.1.0 spec/useragent_parser_spec.rb