Skip to content
This repository
Browse code

basic test for Workerfile

  • Loading branch information...
commit 618bfca2bd094157829a39efcf6c94f4baec370a 1 parent 558c81d
Roman romand authored
2  lib/iron_worker_ng/code/base.rb
@@ -52,7 +52,7 @@ def initialize(*args, &block)
52 52 exec = args[0][:exec] || args[0]['exec'] || args[0][:worker] || args[0]['worker']
53 53 merge_exec(exec) unless exec.nil?
54 54 else
55   - raise "Wrong arguments"
  55 + raise "Wrong arguments" unless args.empty?
56 56 end
57 57
58 58 unless block.nil?
13 test/test_code_create.rb
@@ -29,6 +29,19 @@ def test_create
29 29 code = code_bundle(:exec => 'test/hello.rb', :name => 'dfdfd')
30 30 assert_equal File.expand_path('test/hello.rb'), code.exec_path
31 31 assert_equal 'dfdfd', code.name
  32 +
  33 + code = code_bundle
  34 + assert_equal nil, code.exec_path
  35 + assert_equal nil, code.name
  36 + end
  37 +
  38 + def test_workerfile
  39 + Dir.chdir( Dir.mktmpdir ) do
  40 + File.open('hello.rb', 'w') { |f| f << "puts 'hello'" }
  41 + File.open('Workerfile', 'w') { |f| f << "exec 'hello.rb'" }
  42 +
  43 + assert code_bundle.exec_path.end_with? 'hello.rb'
  44 + end
32 45 end
33 46
34 47 end

0 comments on commit 618bfca

Please sign in to comment.
Something went wrong with that request. Please try again.