diff options
author | Christoph Helma <helma@in-silico.de> | 2010-01-07 18:05:27 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.de> | 2010-01-07 18:05:27 +0100 |
commit | b6ec88dd16ae5bab0b015f886cf2488cb16027e0 (patch) | |
tree | 71fe0c89634091fcbe9c48cb997eca8e5ef3e918 | |
parent | f8e10fe226e408743b57de2d4d8f9ba02eb8bae9 (diff) |
tests for tasks added
-rw-r--r-- | features/step_definitions/task_steps.rb | 20 | ||||
-rw-r--r-- | features/task_complete.feature | 12 | ||||
-rw-r--r-- | features/task_create.feature | 13 |
3 files changed, 45 insertions, 0 deletions
diff --git a/features/step_definitions/task_steps.rb b/features/step_definitions/task_steps.rb new file mode 100644 index 0000000..a503ece --- /dev/null +++ b/features/step_definitions/task_steps.rb @@ -0,0 +1,20 @@ +When /^I create a task for a (.*)$/ do |resource_uri| + @uri = RestClient.post @@config[:services]["opentox-task"], :resource_uri => resource_uri + @resources << @uri +end + +When /^I finish the task$/ do + RestClient.put File.join(@uri,"completed"), nil +end + + +Then /^the status should be "([^\"]*)"$/ do |status| + return_status = RestClient.get File.join(@uri,"status") + assert_equal status, return_status +end + +Then /^the resource should be (.*)$/ do |uri| + resource = RestClient.get File.join(@uri,"resource") + assert_equal uri, resource +end + diff --git a/features/task_complete.feature b/features/task_complete.feature new file mode 100644 index 0000000..961c454 --- /dev/null +++ b/features/task_complete.feature @@ -0,0 +1,12 @@ +@rest @task +Feature: Create and complete a Task + + Scenario Outline: Create and complete a task + Given I create a task for a <resource> + When I finish the task + Then the status should be "completed" + + Examples: + |resource| + |http://my_test_uri| + diff --git a/features/task_create.feature b/features/task_create.feature new file mode 100644 index 0000000..d817f26 --- /dev/null +++ b/features/task_create.feature @@ -0,0 +1,13 @@ +@rest +Feature: Create Task + + Scenario Outline: Create a task + When I create a task for a <resource> + Then I should receive a valid URI + And the status should be "started" + And the resource should be <resource> + + Examples: + |resource| + |http://my_test_uri| + |