Sha256: 316536c4f23300ad734b6d80912af663beead4a53f00d78c60006f70c99e38cd
Contents?: true
Size: 825 Bytes
Versions: 1
Compression:
Stored size: 825 Bytes
Contents
require "test_utils" require "logstash/filters/json_encode" describe LogStash::Filters::JSONEncode do extend LogStash::RSpec describe "encode a field as json" do config <<-CONFIG filter { json_encode { source => "hello" target => "fancy" } } CONFIG hash = { "hello" => { "whoa" => [ 1,2,3 ] } } sample(hash) do insist { JSON.parse(subject["fancy"]).to_json } == hash["hello"].to_json end end describe "encode a field as json and overwrite the original" do config <<-CONFIG filter { json_encode { source => "hello" } } CONFIG hash = { "hello" => { "whoa" => [ 1,2,3 ] } } sample(hash) do insist { JSON.parse(subject["hello"]).to_json } == hash["hello"].to_json end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logstash-lib-1.3.2 | spec/filters/json_encode.rb |