spec/spec_helper.rb in fluent-plugin-elb-access-log-0.3.7 vs spec/spec_helper.rb in fluent-plugin-elb-access-log-0.4.0

- old
+ new

@@ -1,23 +1,17 @@ +require 'coveralls' +Coveralls.wear! + require 'fluent/test' +require 'fluent/test/driver/input' require 'fluent/plugin/in_elb_access_log' require 'aws-sdk-s3' require 'time' require 'timecop' require 'rspec/match_table' -if ENV['TRAVIS'] - require 'simplecov' - require 'coveralls' - - SimpleCov.formatter = Coveralls::SimpleCov::Formatter - SimpleCov.start do - add_filter "spec/" - end -end - # Disable Test::Unit module Test::Unit::RunCount; def run(*); end; end RSpec.configure do |config| config.before(:all) do @@ -44,11 +38,17 @@ s3_bucket #{s3_bucket} region #{region} #{additional_options} EOS - tag = options[:tag] || 'test.default' - Fluent::Test::OutputTestDriver.new(Fluent::ElbAccessLogInput, tag).configure(fluentd_conf) + Fluent::Test::Driver::Input.new(Fluent::Plugin::ElbAccessLogInput).configure(fluentd_conf) +end + +def driver_run(driver) + driver.run do + coolio_loop = driver.instance.instance_variable_get(:@loop) + sleep 0.1 until coolio_loop.instance_variable_get(:@running) + end end # prevent Test::Unit's AutoRunner from executing during RSpec's rake task # ref: https://github.com/rspec/rspec-rails/issues/1171 Test::Unit.run = true if defined?(Test::Unit) && Test::Unit.respond_to?(:run=)