Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

basic test for Workerfile

  • Loading branch information...
commit 618bfca2bd094157829a39efcf6c94f4baec370a 1 parent 558c81d
@romand romand authored
Showing with 14 additions and 1 deletion.
  1. +1 −1  lib/iron_worker_ng/code/base.rb
  2. +13 −0 test/test_code_create.rb
View
2  lib/iron_worker_ng/code/base.rb
@@ -52,7 +52,7 @@ def initialize(*args, &block)
exec = args[0][:exec] || args[0]['exec'] || args[0][:worker] || args[0]['worker']
merge_exec(exec) unless exec.nil?
else
- raise "Wrong arguments"
+ raise "Wrong arguments" unless args.empty?
end
unless block.nil?
View
13 test/test_code_create.rb
@@ -29,6 +29,19 @@ def test_create
code = code_bundle(:exec => 'test/hello.rb', :name => 'dfdfd')
assert_equal File.expand_path('test/hello.rb'), code.exec_path
assert_equal 'dfdfd', code.name
+
+ code = code_bundle
+ assert_equal nil, code.exec_path
+ assert_equal nil, code.name
+ end
+
+ def test_workerfile
+ Dir.chdir( Dir.mktmpdir ) do
+ File.open('hello.rb', 'w') { |f| f << "puts 'hello'" }
+ File.open('Workerfile', 'w') { |f| f << "exec 'hello.rb'" }
+
+ assert code_bundle.exec_path.end_with? 'hello.rb'
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.