seam 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/seam/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Seam
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.13"
3
3
  end
data/lib/seam/worker.rb CHANGED
@@ -69,6 +69,10 @@ module Seam
69
69
  s.to_s
70
70
  end
71
71
 
72
+ def current_step
73
+ effort.flow["steps"][effort.completed_steps.count]
74
+ end
75
+
72
76
  private
73
77
 
74
78
  def mark_effort_as_complete
@@ -640,6 +640,59 @@ describe "worker" do
640
640
  end
641
641
 
642
642
  end
643
+
644
+ describe "making the current step available" do
645
+ it "should return the first step if on the first step" do
646
+ flow = Seam::Flow.new
647
+ flow.apple("test")
648
+ flow.orange
649
+
650
+ effort = flow.start( { first_name: 'John' } )
651
+ effort = Seam::Effort.find(effort.id)
652
+
653
+ effort.next_step.must_equal "apple"
654
+
655
+ apple_worker = Seam::Worker.new
656
+ apple_worker.handles(:apple)
657
+ def apple_worker.process
658
+ current_step.nil?.must_equal false
659
+ current_step["name"].must_equal "apple"
660
+ current_step["arguments"].must_equal ["test"]
661
+ end
662
+
663
+ apple_worker.execute effort
664
+ end
665
+
666
+ it "should return the second step if on the second step" do
667
+ flow = Seam::Flow.new
668
+ flow.apple("test")
669
+ flow.orange("another test")
670
+
671
+ effort = flow.start( { first_name: 'John' } )
672
+ effort = Seam::Effort.find(effort.id)
673
+
674
+ effort.next_step.must_equal "apple"
675
+
676
+ apple_worker = Seam::Worker.new
677
+ apple_worker.handles(:apple)
678
+ def apple_worker.process
679
+ current_step.nil?.must_equal false
680
+ current_step["name"].must_equal "apple"
681
+ current_step["arguments"].must_equal ["test"]
682
+ end
683
+
684
+ orange_worker = Seam::Worker.new
685
+ orange_worker.handles(:orange)
686
+ def orange_worker.process
687
+ current_step.nil?.must_equal false
688
+ current_step["name"].must_equal "orange"
689
+ current_step["arguments"].must_equal ["another test"]
690
+ end
691
+
692
+ apple_worker.execute_all
693
+ orange_worker.execute_all
694
+ end
695
+ end
643
696
  end
644
697
 
645
698
  class IWillNotCallHandlesWorker < Seam::Worker
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -228,7 +228,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  segments:
230
230
  - 0
231
- hash: 4001325286817119125
231
+ hash: 1262616031405311885
232
232
  required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  none: false
234
234
  requirements:
@@ -237,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  version: '0'
238
238
  segments:
239
239
  - 0
240
- hash: 4001325286817119125
240
+ hash: 1262616031405311885
241
241
  requirements: []
242
242
  rubyforge_project:
243
243
  rubygems_version: 1.8.25