Sha256: 4c5f5392cb6af2c45fb7950d23852bcf1157deac464b217b36c50e734d366512

Contents?: true

Size: 1.86 KB

Versions: 2

Compression:

Stored size: 1.86 KB

Contents

require 'spec_helper'

class TestSubject
  include RDee::TargetParser
end


describe RDee::TargetParser do

  let(:parser) { TestSubject.new }

  it "should parse generic Firefox" do
    target, version, host = parser.parse(:firefox)
    expect(target).to eql :firefox
  end

  it "should parse the version number" do
    target, version, host = parser.parse(:firefox30)
    expect(version).to eql '30'
  end

  it "should handle just target and host" do
    target, version, host = parser.parse(:firefox_win81)
    expect(target).to eql :firefox
    expect(host).to eql 'Windows 8.1'
    expect(version).to be_nil
  end

  it "should parse the windows 8.1 host" do
    target, version, host = parser.parse(:firefox30_win81)
    expect(host).to eql 'Windows 8.1'
  end

  it "should parse the windows 8 host" do
    target, version, host = parser.parse(:firefox30_win8)
    expect(host).to eql 'Windows 8'
  end

  it "should parse the windows 7 host" do
    target, version, host = parser.parse(:firefox30_win7)
    expect(host).to eql 'Windows 7'
  end

  it "should parse the windows xp host" do
    target, version, host = parser.parse(:firefox30_winxp)
    expect(host).to eql 'Windows XP'
  end

  it "should parse snow leopard" do
    target, version, host = parser.parse(:firefox30_snow_leopard)
    expect(host).to eql 'OS X 10.6'
  end

  it "should parse mountain lion" do
    target, version, host = parser.parse(:firefox30_mountain_lion)
    expect(host).to eql 'OS X 10.8'
  end

  it "should parse mavricks" do
    target, version, host = parser.parse(:firefox30_mavricks)
    expect(host).to eql 'OS X 10.9'
  end

  it "should parse linux" do
    target, version, host = parser.parse(:firefox30_linux)
    expect(host).to eql 'Linux'
  end

  it "should cleanly handle an invalid host" do
    target, version, host = parser.parse(:firefox30_foobar)
    expect(host).to be_nil
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
RDee-0.2 spec/lib/target_parser_spec.rb
RDee-0.1 spec/lib/target_parser_spec.rb