Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

find process for Workitem

  • Loading branch information...
commit d65b8ef1f0b823c3b358a93de0b90dc9c4b42995 1 parent 00ff828
Torsten Schönebaum authored
Showing with 27 additions and 1 deletion.
  1. +4 −0 lib/ruote-kit/client/workitem.rb
  2. +23 −1 spec/workitem_spec.rb
View
4 lib/ruote-kit/client/workitem.rb
@@ -4,6 +4,10 @@ class Workitem < ::Hash
include EmbeddedAgent
include HashExtensions
+
+ def process
+ agent.find_process(fei['wfid'])
+ end
end
end
end
View
24 spec/workitem_spec.rb
@@ -1,7 +1,29 @@
require File.dirname(__FILE__) + '/spec_helper'
describe RuoteKit::Client::Workitem do
- it "should have a process"
+ before(:each) do
+ @workitem = RuoteKit::Client::Workitem.new({"fei"=> {"class"=>"Ruote::FlowExpressionId", "engine_id"=>"engine", "wfid"=>"20091204-bojupuraju", "expid"=>"0_0_0"}, "participant_name"=>"nada", "fields"=>{"params"=>{"activity"=>"REST :)", "ref"=>"nada"}}, "links"=>[{"href"=>"/processes/20091204-bojupuraju", "rel"=>"http://ruote.rubyforge.org/rels.html#process"}, {"href"=>"/expressions/20091204-bojupuraju", "rel"=>"http://ruote.rubyforge.org/rels.html#expressions"}]})
+
+ @agent = RuoteKit::Client::Agent.new('http://localhost:8080/')
+ @workitem.agent = @agent
+ end
+
+ it "should have a process" do
+ mock_request(
+ @agent,
+ :get,
+ '/processes/20091204-bojupuraju',
+ nil,
+ { :accept => 'application/json' },
+ { "process" => {"wfid"=>"20091204-bojupuraju", "definition_name"=>"test", "definition_revision"=>nil, "original_tree"=>["define", {"name"=>"test"}, [["sequence", {}, [["nada", {"activity"=>"REST :)"}, []]]]]], "current_tree"=>["define", {"name"=>"test"}, [["sequence", {}, [["participant", {"activity"=>"REST :)", "ref"=>"nada"}, []]]]]], "variables"=>{"test"=>["0", ["define", {"name"=>"test"}, [["sequence", {}, [["nada", {"activity"=>"REST :)"}, []]]]]]]}, "tags"=>{}, "launched_time"=>"2009-12-04 12:04:55 +0200", "root_expression"=>nil, "expressions"=>[{"class"=>"Ruote::FlowExpressionId", "engine_id"=>"engine", "wfid"=>"20091204-bojupuraju", "expid"=>"0"}, {"class"=>"Ruote::FlowExpressionId", "engine_id"=>"engine", "wfid"=>"20091204-bojupuraju", "expid"=>"0_0"}, {"class"=>"Ruote::FlowExpressionId", "engine_id"=>"engine", "wfid"=>"20091204-bojupuraju", "expid"=>"0_0_0"}], "errors"=>[], "links"=>[{"href"=>"/processes/20091204-bojupuraju", "rel"=>"http://ruote.rubyforge.org/rels.html#process"}, {"href"=>"/expressions/20091204-bojupuraju", "rel"=>"http://ruote.rubyforge.org/rels.html#expressions"}, {"href"=>"/workitems/20091204-bojupuraju", "rel"=>"http://ruote.rubyforge.org/rels.html#workitems"}]}}
+ )
+
+ process = @workitem.process
+ process.should_not be_nil
+ process.should be_a_kind_of( RuoteKit::Client::Process )
+ process.agent.should_not be_nil
+ process.wfid.should == @workitem['fei']['wfid']
+ end
it "should have an expression"
it "can be updated"
it "can be proceeded"
Please sign in to comment.
Something went wrong with that request. Please try again.