-
-
Save croaky/2401393 to your computer and use it in GitHub Desktop.
Advice on DRYing this test up?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FIREFOX_FIXTURES = [ | |
{ | |
browser: 'Firefox', | |
gecko_version: '20101203', | |
os: 'Intel Mac OS X 10.6', | |
platform: 'Macintosh', | |
raw: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13', | |
version: '3.6.13' | |
}, | |
{ | |
browser: 'Firefox', | |
gecko_version: '20100101', | |
os: 'Intel Mac OS X 10.6', | |
platform: 'Macintosh', | |
raw: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b8) Gecko/20100101 Firefox/4.0b8', | |
version: '4.0b8' | |
} | |
] | |
describe 'self.parse' do | |
FIREFOX_FIXTURES.each do |fixture| | |
context "given #{fixture}" do | |
before do | |
@user_agent = UserAgent.parse(fixture[:raw]) | |
end | |
it 'is not mobile' do | |
@user_agent.should_not be_mobile | |
end | |
it 'is not Webkit' do | |
@user_agent.should_not be_webkit | |
end | |
it 'sets browser to Firefox' do | |
@user_agent.browser.should == fixture[:browser] | |
end | |
it 'sets correct gecko version' do | |
@user_agent.gecko.version.should == fixture[:gecko_version] | |
end | |
it 'sets correct operating system' do | |
@user_agent.os.should == fixture[:os] | |
end | |
it 'sets correct platform' do | |
@user_agent.platform.should == fixture[:platform] | |
end | |
it 'sets correct version' do | |
@user_agent.version.should == fixture[:version] | |
end | |
it 'sets localization to nil' do | |
@user_agent.localization.should be_nil | |
end | |
it 'sets security to strong' do | |
@user_agent.security.should == :strong | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment