Sha256: 166c9b24b759e55d8385fe5f95cb8f55dc021b77b72dd80347db51423afed5ac

Contents?: true

Size: 1.55 KB

Versions: 4

Compression:

Stored size: 1.55 KB

Contents

#
# This file is part of the brauser gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
#

require "spec_helper"

describe ::Brauser::Definitions do
  describe ".register" do
    it "should register a new definition" do
      dummy = ::OpenStruct.new(id: :definition)
      expect(::Brauser::Definitions::Browser).to receive(:new).with("A", "B", "C", a: 1, b: 2, c:3).and_return(dummy)
      ::Brauser::Definitions.register(:browser, "A", "B", "C", a: 1, b: 2, c:3)
      expect(::Brauser::Definitions.browsers[:definition]).to be(dummy)
      ::Brauser::Definitions.browsers.delete(:definition)
    end

    it "should raise an error for invalid types" do
      expect { ::Brauser::Definitions.register(:none, "A", "B", "C", a: 1, b: 2, c:3) }.to raise_error(::ArgumentError)
    end
  end

  describe ".browsers" do
    it "should return the list of browsers" do
      expect(::Brauser::Definitions.browsers).to include(:chrome)
    end
  end

  describe ".platforms" do
    it "should return the list of platforms" do
      expect(::Brauser::Definitions.platforms).to include(:osx)
    end
  end

  describe ".languages" do
    it "should return the list of languages" do
      expect(::Brauser::Definitions.languages).to include(:it)
    end
  end
end

describe ::Brauser::Definitions::Base do
  describe "#match" do
    it "should raise an error" do
      expect { ::Brauser::Definitions::Base.new.match(:unused) }.to raise_error(::RuntimeError)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brauser-4.1.2 spec/brauser/definitions/base_spec.rb
brauser-4.1.1 spec/brauser/definitions/base_spec.rb
brauser-4.1.0 spec/brauser/definitions/base_spec.rb
brauser-4.0.0 spec/brauser/definitions/base_spec.rb