Sha256: ccf83353e1a38bc7022594e598678f6b0ee9172455d4e828c31ded2c7392e192
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
require "test_helper" class MetaTest < Minitest::Test class CustomRule < Browser::Meta::Base def meta "custom" if browser.ua =~ /Custom/ end end test "extend rules" do Browser::Meta.rules.unshift(CustomRule) browser = Browser.new("Custom") assert browser.meta.include?("custom") browser = Browser.new("Safari") refute browser.meta.include?("custom") Browser::Meta.rules.shift browser = Browser.new("Custom") refute browser.meta.include?("custom") end test "sets meta" do browser = Browser.new(Browser["CHROME"]) assert_kind_of Array, browser.meta end test "returns string representation" do browser = Browser.new(Browser["CHROME"]) meta = browser.to_s assert meta.include?("chrome") assert meta.include?("webkit") assert meta.include?("mac") assert meta.include?("modern") end test "returns string representation for mobile" do browser = Browser.new(Browser["BLACKBERRY"]) meta = browser.to_s assert meta.include?("blackberry") assert meta.include?("mobile") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
browser-2.2.0 | test/unit/meta_test.rb |
browser-2.1.0 | test/unit/meta_test.rb |
browser-2.0.3 | test/unit/meta_test.rb |