spec/inputs/file_spec.rb in logstash-input-file-1.0.0 vs spec/inputs/file_spec.rb in logstash-input-file-1.0.1
- old
+ new
@@ -1,10 +1,11 @@
# encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
require "tempfile"
require "stud/temporary"
+require "logstash/inputs/file"
describe "inputs/file" do
delimiter = (LogStash::Environment.windows? ? "\r\n" : "\n")
@@ -162,7 +163,21 @@
insist { events[0]["path"] } == "my_path"
insist { events[0]["host"] } == "my_host"
insist { events[1]["path"] } == "#{tmpfile_path}"
insist { events[1]["host"] } == "#{Socket.gethostname.force_encoding(Encoding::UTF_8)}"
+ end
+
+ context "when sincedb_path is an existing directory" do
+ let(:tmpfile_path) { Stud::Temporary.pathname }
+ let(:sincedb_path) { Stud::Temporary.directory }
+ subject { LogStash::Inputs::File.new("path" => tmpfile_path, "sincedb_path" => sincedb_path) }
+
+ after :each do
+ FileUtils.rm_rf(sincedb_path)
+ end
+
+ it "should raise exception" do
+ expect { subject.register }.to raise_error(ArgumentError)
+ end
end
end