Sha256: 8268778ebe6e841795c5b4e5ababe4b442654d40d8fd1f164635a479e5b0a5d2

Contents?: true

Size: 918 Bytes

Versions: 24

Compression:

Stored size: 918 Bytes

Contents

# frozen_string_literal: true

require "test_helper"
require "browser/aliases"

class AliasesTest < Minitest::Test
  class BrowserMock
    include Browser::Aliases

    def platform
      @platform ||= Object.new
    end

    def device
      @device ||= Object.new
    end
  end

  Browser::Aliases::PLATFORM_ALIASES.each do |method_name|
    test "adds #{method_name.inspect} as a platform alias" do
      browser = BrowserMock.new

      browser.platform.define_singleton_method(method_name) do
        :called
      end

      assert_equal :called, browser.public_send(method_name)
    end
  end

  Browser::Aliases::DEVICE_ALIASES.each do |method_name|
    test "adds #{method_name.inspect} as a device alias" do
      browser = BrowserMock.new

      browser.device.define_singleton_method(method_name) do
        :called
      end

      assert_equal :called, browser.public_send(method_name)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
browser-6.2.0 test/unit/aliases_test.rb
browser-6.1.0 test/unit/aliases_test.rb
browser-6.0.0 test/unit/aliases_test.rb
browser-5.3.1 test/unit/aliases_test.rb
browser-5.3.0 test/unit/aliases_test.rb
browser-5.2.0 test/unit/aliases_test.rb
browser-5.1.0 test/unit/aliases_test.rb
browser-5.0.0 test/unit/aliases_test.rb
browser-4.2.0 test/unit/aliases_test.rb
browser-4.1.0 test/unit/aliases_test.rb
browser-4.0.0 test/unit/aliases_test.rb
browser-3.0.3 test/unit/aliases_test.rb
browser-3.0.2 test/unit/aliases_test.rb
browser-3.0.1 test/unit/aliases_test.rb
browser-3.0.0 test/unit/aliases_test.rb
browser-2.7.1 test/unit/aliases_test.rb
browser-2.7.0 test/unit/aliases_test.rb
browser-2.6.1 test/unit/aliases_test.rb
browser-2.6.0 test/unit/aliases_test.rb
browser-2.5.3 test/unit/aliases_test.rb