Skip to content

Commit

Permalink
add basic test for the dot encode and decode
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
Pere Urbon-Bayes authored and jordansissel committed Aug 21, 2015
1 parent adb9319 commit 3ca22a8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
37 changes: 36 additions & 1 deletion spec/codecs/dots_spec.rb
@@ -1 +1,36 @@
require "logstash/devutils/rspec/spec_helper"
# encoding: utf-8

require_relative "../spec_helper"
require "logstash/plugin"
require "logstash/event"

describe LogStash::Codecs::Dots do

it "should initialize without errors" do
klass = LogStash::Plugin.lookup("codec", "dots")
expect { klass.new }.to_not raise_error
end

describe "event encoding" do

let(:properties) { {:name => "foo" } }
let(:event) { LogStash::Event.new(properties) }

it "should encode as a dot" do
subject.on_event do |event, data|
expect(data).to eq(".")
end
subject.encode(event)
end

end

describe "event decoding" do

it "should raise an exception" do
expect { subject.decode }.to raise_error
end

end

end
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
@@ -0,0 +1,2 @@
require "logstash/devutils/rspec/spec_helper"
require "logstash/codecs/dots"

0 comments on commit 3ca22a8

Please sign in to comment.