Sha256: 382650f63c207f8fd88d2870f01e27400fcbd7828c65a7dff59b8028ced9f9b6
Contents?: true
Size: 1.78 KB
Versions: 2
Compression:
Stored size: 1.78 KB
Contents
# encoding: utf-8 require_relative '../spec_helper' require "logstash/filters/device_detection" DATAFILE = ::Dir.glob(::File.expand_path("../../vendor/", ::File.dirname(__FILE__))+"/51Degrees-LiteV3.2.dat").first describe LogStash::Filters::DeviceDetection do describe "properties is not set" do let(:config) do <<-CONFIG filter { device_detection { #datafile => "#{DATAFILE}" source => "user_agent" target => "device_detection" } } CONFIG end sample("user_agent" => "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0") do expect { subject }.to raise_error(RuntimeError) end end describe "empty properties" do let(:config) do <<-CONFIG filter { device_detection { #datafile => "#{DATAFILE}" source => "user_agent" target => "device_detection" properties => [] } } CONFIG end sample("user_agent" => "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0") do expect { subject }.to raise_error(RuntimeError) end end describe "defaults" do let(:config) do <<-CONFIG filter { device_detection { #datafile => "#{DATAFILE}" source => "user_agent" target => "device_detection" properties => ["BrowserName","BrowserVersion","IsMobile"] } } CONFIG end sample("user_agent" => "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0") do expect(subject.get('[device_detection][BrowserName]')).to eq('Firefox') expect(subject.get('[device_detection][BrowserVersion]')).to eq('41.0') expect(subject.get('[device_detection][IsMobile]')).to eq('False') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
logstash-filter-device_detection-1.0.7-java | spec/filters/device_detection_spec.rb |
logstash-filter-device_detection-1.0.0-java | spec/filters/device_detection_spec.rb |