From 1cc5f5525439aa29e5b7891d945e249eda870529 Mon Sep 17 00:00:00 2001 From: Kazuyuki Honda Date: Sun, 17 Jul 2016 15:19:53 +0900 Subject: [PATCH] Update test --- test/cli_test.rb | 20 ++++++++++++++------ test/plugin/task/google_drive_folder_test.rb | 2 +- test/test_helper.rb | 6 ++++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/test/cli_test.rb b/test/cli_test.rb index 01f370a..f95bdbb 100644 --- a/test/cli_test.rb +++ b/test/cli_test.rb @@ -1,17 +1,25 @@ require_relative './test_helper' require 'tumugi/cli' -class Tumugi::Plugin::GoogleDriveCLITest < Test::Unit::TestCase +class Tumugi::Plugin::GoogleDriveCLITest < Tumugi::Test::TumugiTestCase examples = { 'example' => ['example.rb', 'task1'], } - def invoke(file, task, options) - Tumugi::CLI.new.invoke(:run_, [task], options.merge(file: "./examples/#{file}", quiet: true)) + setup do + system('rm -rf tmp/*') end - data(examples) - test 'success' do |(file, task)| - assert_true(invoke(file, task, worker: 4, params: { 'day' => '2016-05-01' }, config: "./examples/tumugi_config_example.rb")) + data do + data_set = {} + examples.each do |k, v| + [1, 2, 8].each do |n| + data_set["#{k}_workers_#{n}"] = (v.dup << n) + end + end + data_set + end + test 'success' do |(file, task, worker)| + assert_run_success("examples/#{file}", task, workers: worker, params: { "day" => "2016-05-01" }, config: "./examples/tumugi_config_example.rb") end end diff --git a/test/plugin/task/google_drive_folder_test.rb b/test/plugin/task/google_drive_folder_test.rb index 6b10c5a..b418b84 100644 --- a/test/plugin/task/google_drive_folder_test.rb +++ b/test/plugin/task/google_drive_folder_test.rb @@ -20,7 +20,7 @@ class Tumugi::Plugin::GoogleDriveFolderTaskTest < Test::Unit::TestCase }) test "raise error when required parameter is not set" do |params| params.each do |param| - @klass.param_set(param, nil) + @klass.set(param, nil) end assert_raise(Tumugi::ParameterError) do @klass.new diff --git a/test/test_helper.rb b/test/test_helper.rb index 6a36419..e693a4a 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -10,9 +10,11 @@ require 'test/unit' require 'test/unit/rr' -require 'json' - require 'tumugi' +require 'tumugi/test/helper' +include Tumugi::Test::Helpers + +require 'json' Dir.mkdir('tmp') unless Dir.exist?('tmp')