Sha256: 3f56691c3863024be9af3bc05ee9ee874acb80c78b00cb2ba1a47a6c0323aa67
Contents?: true
Size: 1.76 KB
Versions: 2
Compression:
Stored size: 1.76 KB
Contents
require "logstash/devutils/rspec/spec_helper" require "insist" require "logstash/filters/tld" describe LogStash::Filters::Tld do describe "Set to TLD" do config <<-CONFIG filter { tld { } } CONFIG #{ # "message" => "google.com", # "@version" => "1", # "@timestamp" => "2015-01-22T17:33:19.669Z", # "host" => "homer", # "sequence" => 0, # "tld" => { # "tld" => "com", # "sld" => "google", # "trd" => nil, # "domain" => "google.com", # "subdomain" => nil # } sample("message" => "google.com") do insist { subject.get("tld")["tld"] } == "com" insist { subject.get("tld")["top_level_domain"] } == "com" insist { subject.get("tld")["sld"] } == "google" insist { subject.get("tld")["trd"] } == nil insist { subject.get("tld")["domain"] } == "google.com" insist { subject.get("tld")["subdomain"] } == nil end sample("message" => "google.co.uk") do insist { subject.get("tld")["tld"] } == "co.uk" insist { subject.get("tld")["top_level_domain"] } == "co.uk" insist { subject.get("tld")["sld"] } == "google" insist { subject.get("tld")["trd"] } == nil insist { subject.get("tld")["domain"] } == "google.co.uk" insist { subject.get("tld")["subdomain"] } == nil end sample("message" => "www.google.com") do insist { subject.get("tld")["tld"] } == "com" insist { subject.get("tld")["top_level_domain"] } == "com" insist { subject.get("tld")["sld"] } == "google" insist { subject.get("tld")["trd"] } == "www" insist { subject.get("tld")["domain"] } == "google.com" insist { subject.get("tld")["subdomain"] } == "www.google.com" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
logstash-filter-tld-3.1.2 | spec/filters/tld_spec.rb |
logstash-filter-tld-3.1.1 | spec/filters/tld_spec.rb |