fluent/fluentd — pull request #170 by sonots (2013-08-10 13:37:50+00:00)
Title: PROPOSE: support time in pitch (plugin_spec_helper)

@tagomoris

In addition to

time = Time.now.to_i
d.with('xxx', time) do |d|
d.pitch({"f1"=>"data1", "f2"=>"data2"})
end

I propose to support ways to write test as

time = Time.now.to_i
d.with('xxx') do |d|
d.pitch({"f1"=>"data1", "f2"=>"data2"}, time)
end

and

d.with('xxx') do |d|
d.pitch({"f1"=>"data1", "f2"=>"data2"})
end

The 2nd way it good for v10 compatibility since v10's TestDriver#emit supports 2 arguments as

def emit(record, time=Time.now)

Futhermore, someone may want to write test with different `time`s. We should support it.

The 3rd way is the simplest way to write test. We often do not care of time in some test cases.
In the 3rd way, the time property is initialized with Time.now.to_i internally.