-
Notifications
You must be signed in to change notification settings - Fork 22
/
test_ruby_runner.rb
41 lines (31 loc) · 1.17 KB
/
test_ruby_runner.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require 'helpers.rb'
class RubyRunnerTest < IWNGTest
def test_script
code = code_bundle 'test/workers/ruby_runner_test_script.rb'
client.codes_create(code)
task_id = client.tasks_create('RubyRunnerTestScript',
:a => 1, :b => 2).id
client.tasks_wait_for(task_id)
resp = JSON.parse client.tasks_log(task_id)
puts resp.to_s
assert_equal( { "a" => 1, "b" => 2 }, resp['params'],
"correct params" )
assert_equal resp['params'], JSON.parse(resp['payload']),
"params are parsed payload"
assert resp['iron_task_id'] =~ /[0-9a-f]{24}/,
"iron_task_id available"
assert resp['indifferent_access'], "indifferent access works"
end
def test_class
code = code_bundle do
exec 'test/workers/ruby_runner_test_class.rb', 'RubyWorker'
end
client.codes_create(code)
task_id = client.tasks_create('RubyRunnerTestClass',
:a => 1, :b => 2).id
client.tasks_wait_for(task_id)
assert_equal( { 'a' => 1, 'b' => 2 },
JSON.parse( client.tasks_log(task_id) ),
"correct output" )
end
end