test/integration_tests.rb in crowdflower-0.2.3 vs test/integration_tests.rb in crowdflower-0.3.0
- old
+ new
@@ -1,9 +1,9 @@
$: << File.dirname(__FILE__) + "/../lib"
require 'rubygems'
-require 'ruby-crowdflower'
+require 'crowdflower'
require 'json'
API_KEY = ENV["API_KEY"]
unless API_KEY && API_KEY.size > 5
@@ -85,9 +85,25 @@
say "Checking the status of the job."
assert job.status["tainted_judgments"] == 0
say "Registering a webhook."
job.update :webhook_uri => "http://localhost:8080/crowdflower"
+
+say "Adding title, instructions, and problem to the job."
+job.update({:title => 'testtt', :instructions => 'testttt fdsf sfds fsdfs fesfsdf', :problem => '<cml:text label="Text" class="unmodified"/>' })
+
+say "Ordering the job."
+order = CrowdFlower::Order.new(job)
+unit_count = 8
+order.debit(8)
+wait_until { job.status["needed_judgments"] == 24}
+
+say "Canceling the unit."
+unit_id = job.units.all.to_a[0][0]
+unit = CrowdFlower::Unit.new(job)
+assert unit.get(unit_id)['state'] == 'judgable'
+puts unit.cancel(unit_id).inspect
+assert unit.get(unit_id)['state'] == 'new'
say "Webhook test needs to be written."
#job.test_webhook
say ">-< Tests complete. >-<"