Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Uses UberConfig.

Added rake test tasks.
Added some assertions.
  • Loading branch information...
commit caeaa1cb96518d81f48a4c622c8614f5f42eac22 1 parent 31fa2e8
@treeder treeder authored
View
3  Gemfile
@@ -5,7 +5,8 @@ gem 'rest-client'
gem 'rest'
gem 'json'
gem 'bundler', '> 1.0.0'
+gem 'uber_config'
group :development do
- gem 'jeweler', '~> 1.8.3'
+ gem 'jeweler2'
end
View
12 Gemfile.lock
@@ -2,21 +2,16 @@ GEM
remote: http://rubygems.org/
specs:
git (1.2.5)
- jeweler (1.8.3)
- bundler (~> 1.0)
+ jeweler2 (2.0.9)
git (>= 1.2.5)
- rake
- rdoc
json (1.6.6)
mime-types (1.18)
- rake (0.9.2.2)
- rdoc (3.12)
- json (~> 1.4)
rest (0.2.0)
rest-client
rest-client
rest-client (1.6.7)
mime-types (>= 1.16)
+ uber_config (0.0.1)
zip (2.0.2)
PLATFORMS
@@ -24,8 +19,9 @@ PLATFORMS
DEPENDENCIES
bundler (> 1.0.0)
- jeweler (~> 1.8.3)
+ jeweler2
json
rest
rest-client
+ uber_config
zip
View
9 Rakefile
@@ -1,6 +1,6 @@
require 'rubygems'
require 'bundler'
-require 'jeweler'
+require 'jeweler2'
Jeweler::Tasks.new do |gem|
begin
@@ -21,3 +21,10 @@ Jeweler::Tasks.new do |gem|
end
Jeweler::RubygemsDotOrgTasks.new
+
+require 'rake/testtask'
+Rake::TestTask.new(:test) do |test|
+ test.libs << 'lib' << 'test'
+ test.pattern = 'test/**/test_*.rb'
+ test.verbose = true
+end
View
13 test/helpers.rb
@@ -1,6 +1,6 @@
require 'test/unit'
require 'tempfile'
-
+require 'uber_config'
require './lib/iron_worker_ng.rb'
def code_bundle(*args,&block)
@@ -36,9 +36,14 @@ class IWNGTest < Test::Unit::TestCase
def setup
IronWorkerNG::Logger.logger.level = ::Logger::DEBUG
- token, project_id = [ ENV['IRON_IO_TOKEN'], ENV['IRON_IO_PROJECT_ID'] ]
- raise("please set $IRON_IO_TOKEN and $IRON_IO_PROJECT_ID " +
- "environment variables") unless token and project_id
+ @config = UberConfig.load(:dir=>"iron_worker_ruby")
+ p @config
+ token = ENV['IRON_TOKEN'] || @config['iron']['token']
+ project_id = ENV['IRON_PROJECT_ID'] || @config['iron']['project_id']
+
+ # client should raise this itself.
+ #raise("please set $IRON_IO_TOKEN and $IRON_IO_PROJECT_ID " +
+ # "environment variables") unless token and project_id
@client = IronWorkerNG::Client.new(:token => token,
:project_id => project_id )
View
6 test/test_basic.rb
@@ -6,7 +6,11 @@ def _test_basic
code.merge_exec(File.dirname(__FILE__) + '/hello.rb')
client.codes_create(code)
task_id = client.tasks_create('test_basic').id
- client.tasks_wait_for(task_id)
+ task = client.tasks_wait_for(task_id)
+ p task
+ assert task
+ assert task.id == task_id
+ assert task.status == "complete"
log = client.tasks_log(task_id)
assert_equal( "hello\n", log, "worker stdout is in log" )
end
Please sign in to comment.
Something went wrong with that request. Please try again.