Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
hakobera committed Jul 17, 2016
1 parent c4a66d1 commit 1cc5f55
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
20 changes: 14 additions & 6 deletions test/cli_test.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/plugin/task/google_drive_folder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down

0 comments on commit 1cc5f55

Please sign in to comment.