Sha256: 11eac22cc7da703f43cbeefe6ee5b92e458268f3304f89b708d14e4c035b248b

Contents?: true

Size: 575 Bytes

Versions: 9

Compression:

Stored size: 575 Bytes

Contents

require "logstash/devutils/rspec/spec_helper"

require "logstash/filters/dictionary/yaml_visitor"

describe LogStash::Filters::Dictionary::YamlVisitor do
  it 'works' do
    yaml_string = "---\na: \n x: 3\nb: \n x: 4\n"
    dictionary = {"c" => {"x" => 5}}
    described_class.create.accept_with_dictionary(dictionary, Psych.parse_stream(yaml_string)).first
    expect(dictionary.keys.sort).to eq(["a", "b", "c"])
    values = dictionary.values
    expect(values[0]).to eq({"x" => 5})
    expect(values[1]).to eq({"x" => 3})
    expect(values[2]).to eq({"x" => 4})
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logstash-filter-translate-3.4.2 spec/filters/yaml_visitor_spec.rb
logstash-filter-translate-3.4.1 spec/filters/yaml_visitor_spec.rb
logstash-filter-translate-3.4.0 spec/filters/yaml_visitor_spec.rb
logstash-filter-translate-3.3.1 spec/filters/yaml_visitor_spec.rb
logstash-filter-translate-3.3.0 spec/filters/yaml_visitor_spec.rb
logstash-filter-translate-3.2.3 spec/filters/yaml_visitor_spec.rb
logstash-filter-translate-3.2.2 spec/filters/yaml_visitor_spec.rb
logstash-filter-translate-3.2.1 spec/filters/yaml_visitor_spec.rb
logstash-filter-translate-3.2.0 spec/filters/yaml_visitor_spec.rb