There is the complete test and the process file. I was just trying to
understand rspec testing as that is how I develop.
require 'ruote'
require 'ruote/storage/fs_storage'
describe Idp::InitializeDirectoryParticipant, "an attempt to spec
ruote process definitions" do
before(:each) do
# @storage = Ruote::HashStorage.new
@storage = Ruote::FsStorage.new("/tmp/phynet-ruote/")
@worker = Ruote::Worker.new(@storage)
@engine = Ruote::Engine.new(@worker)
end
it "should initialize a directory" do
foo = Time.now.to_i
foo = "/tmp/phy#{foo.to_s}"
@engine.register_participant 'initialize_directory',
Idp::InitializeDirectoryParticipant
process_def = Ruote.process_definition :name => 'init' do
sequence do
set :field => 'dir', :value => foo
participant :ref => 'initialize_directory'
end
end
ARGV << "-d"
wfid = @engine.launch(process_def)
@engine.wait_for(wfid)
File.exists?(foo).should be_true
end
end
require 'fileutils'
require 'ruote'
require 'ruote/participant'
module Idp
class InitializeDirectoryParticipant
include Ruote::LocalParticipant
def initialize (opts, &block)
end
def consume(workitem)
FileUtils.mkdir(workitem.fields['dir']) unless File.exists?
(workitem.fields['dir'])
reply_to_engine(workitem)
end
def cancel (fei, flavour)
FileUtils.rm_rf(workitem[:dir]) if File.exists?(workitem[:dir])
end
end
end
On Jul 6, 5:37 pm, John Mettraux <[email protected]> wrote:
> On Tue, Jul 06, 2010 at 07:46:48PM -0700, Don French wrote:
>
> > I am trying to use this sample rspec test.
> > before(:each) do
> > @storage = Ruote::FsStorage.new("/tmp/phynet-ruote/")
> > @worker = Ruote::Worker.new(@storage)
> > @engine = Ruote::Engine.new(@worker)
> > end
>
> > An I get the following error:
>
> > LoadError in 'Idp::InitializeDirectoryParticipant an attempt to spec
> > ruote process definitions should initialize a directory'
> > no such file to load -- ./log/test_logger
> > /Users/dhf/.rvm/gems/ruby-1.9.1-p378/gems/ruote-2.1.11/lib/ruote/
> > context.rb:116:in `require'
>
> Hello Don,
>
> the code is complaining about
>
> require 'log/test_logger'
>
> Are you sure this is really the initialization code that you are showing on
> top that is involved ?
>
> In ruote code (and test code), this test logger is always referenced via
> 'ruote/log/test_logger'. I guess a quick "grep -r test_logger ." in your code
> could help.
>
> Best regards,
>
> --
> John Mettraux -http://jmettraux.wordpress.com
--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en