yawl 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/yawl/process.rb CHANGED
@@ -54,7 +54,15 @@ module Yawl
54
54
  !%w[completed failed].include?(state)
55
55
  end
56
56
 
57
+ def object
58
+ return unless values[:object_id] && object_type
59
+
60
+ klass = Object.const_get(object_type)
61
+ klass[ values[:object_id] ]
62
+ end
63
+
57
64
  def current?
65
+ self.id == self.class.filter(:object_type => object_type, :object_id => values[:object_id]).order(:id).reverse.get(:id)
58
66
  end
59
67
 
60
68
  def start_first_unfinished_step_or_complete
data/lib/yawl/setup.rb CHANGED
@@ -18,7 +18,8 @@ module Yawl
18
18
  String :name, :text=>true
19
19
  json :config
20
20
  String :request_id, :text=>true
21
- String :specified_attributes
21
+ String :object_type
22
+ Integer :object_id
22
23
  end
23
24
 
24
25
  create_table(:steps) do
data/lib/yawl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yawl
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,22 @@
1
+ require "spec_helper"
2
+
3
+ class FakeObject
4
+ def self.[](value)
5
+ end
6
+ end
7
+
8
+ describe Yawl::Process do
9
+ before(:each) do
10
+ Yawl::ProcessDefinitions.add :tested do |process|
11
+ process.add_step(:name => "testing")
12
+ end
13
+
14
+ @process = Yawl::Process.create(:object_type => "FakeObject", :object_id => 123, :desired_state => "tested")
15
+ @fake_object = FakeObject.new
16
+ FakeObject.stub(:[]).with(123) { @fake_object }
17
+ end
18
+
19
+ it "loads object" do
20
+ @process.object.should == @fake_object
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yawl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-20 00:00:00.000000000 Z
12
+ date: 2014-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel
@@ -153,6 +153,7 @@ files:
153
153
  - lib/yawl/worker.rb
154
154
  - migrations/01_setup_tables.rb
155
155
  - migrations/02_setup_queue_classic.rb
156
+ - spec/lib/process_spec.rb
156
157
  - spec/lib/step_spec.rb
157
158
  - spec/spec_helper.rb
158
159
  - yawl.gemspec
@@ -171,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
172
  version: '0'
172
173
  segments:
173
174
  - 0
174
- hash: 4040071975570743146
175
+ hash: 2215781660990008421
175
176
  required_rubygems_version: !ruby/object:Gem::Requirement
176
177
  none: false
177
178
  requirements:
@@ -180,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
181
  version: '0'
181
182
  segments:
182
183
  - 0
183
- hash: 4040071975570743146
184
+ hash: 2215781660990008421
184
185
  requirements: []
185
186
  rubyforge_project:
186
187
  rubygems_version: 1.8.23
@@ -188,5 +189,6 @@ signing_key:
188
189
  specification_version: 3
189
190
  summary: Yet Another Workflow Library for Ruby
190
191
  test_files:
192
+ - spec/lib/process_spec.rb
191
193
  - spec/lib/step_spec.rb
192
194
  - spec/spec_helper.rb