workflow_on_mongoid 0.8.0.7 → 1.0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
+ - 2.0.0
4
5
  - jruby
5
6
  before_script:
6
7
  - sudo apt-get install -qq graphviz
data/README.rdoc CHANGED
@@ -19,9 +19,8 @@ That is all. Now you can use {Workflow}[http://github.com/geekq/workflow] with y
19
19
 
20
20
  == Versioning
21
21
 
22
- The version numbers of workflow_on_mongoid track the latest supported version of {Workflow}[http://github.com/geekq/workflow] . The major version number (x.x.x) matches the latest supported version of the Workflow gem, while the minor version number (0.7.0.x) tracks changes to workflow_on_mongoid itself.
22
+ The version numbers of workflow_on_mongoid track the latest supported version of {Workflow}[http://github.com/geekq/workflow] . The major version number (x.x.x) matches the latest supported version of the Workflow gem, while the minor version number (0.7.0.y) tracks changes to workflow_on_mongoid itself.
23
23
 
24
- NOTE: workflow_on_mongoid 0.8.0 uses Mongoid 2.0.0.beta.20 . 0.8.0.1+ uses the latest Mongoid 2.0.0.rc . Please choose the appropriate version of workflow_on_mongoid based on the version of Mongoid you are using (the changes from Mongoid 2.0.0.beta to 2.0.0.rc are significant!)
25
24
 
26
25
  == Example
27
26
  class MongoidImage
@@ -59,5 +58,6 @@ workflow_on_mongoid is hosted on Github: http://github.com/bowsersenior/workflow
59
58
  Special thanks to:
60
59
  * Guilherme Cirne (https://github.com/gcirne)
61
60
  * Dariusz Gertych (https://github.com/chytreg)
61
+ * David Butler (https://github.com/dwbutler)
62
62
 
63
- Copyright (c) 2011 Mani Tadayon, released under the MIT License
63
+ Copyright (c) 2011 Mani Tadayon, released under the MIT License
@@ -2,5 +2,5 @@
2
2
  module WorkflowOnMongoid #:nodoc
3
3
  # major version number matches the latest supported version of the Workflow gem
4
4
  # minor version number for tracking changes to workflow_on_mongoid itself
5
- VERSION = "0.8.0.7"
6
- end
5
+ VERSION = "1.0.0.0"
6
+ end
data/test/main_test.rb CHANGED
@@ -13,7 +13,7 @@ else
13
13
  end
14
14
 
15
15
  require 'workflow'
16
- require 'mocha'
16
+ require 'mocha/setup'
17
17
  require 'stringio'
18
18
 
19
19
  ActiveRecord::Migration.verbose = false
@@ -3,87 +3,81 @@ $:.unshift test_dir unless $:.include?(test_dir)
3
3
 
4
4
  require 'test_helper'
5
5
 
6
- unless RUBY_VERSION =~ /^1\.9/
7
- class MultipleWorkflowsTest < ActiveRecordTestCase
6
+ class MultipleWorkflowsTest < ActiveRecordTestCase
8
7
 
9
- test 'multiple workflows' do
8
+ test 'multiple workflows' do
10
9
 
11
- ActiveRecord::Schema.define do
12
- create_table :bookings do |t|
13
- t.string :title, :null => false
14
- t.string :workflow_state
15
- t.string :workflow_type
16
- end
10
+ ActiveRecord::Schema.define do
11
+ create_table :bookings do |t|
12
+ t.string :title, :null => false
13
+ t.string :workflow_state
14
+ t.string :workflow_type
17
15
  end
16
+ end
18
17
 
19
- exec "INSERT INTO bookings(title, workflow_state, workflow_type) VALUES('booking1', 'initial', 'workflow_1')"
20
- exec "INSERT INTO bookings(title, workflow_state, workflow_type) VALUES('booking2', 'initial', 'workflow_2')"
21
-
22
- class Booking < ActiveRecord::Base
23
- def initialize_workflow
24
- # define workflow per object instead of per class
25
- case workflow_type
26
- when 'workflow_1'
27
- class << self
28
- include Workflow
29
- workflow do
30
- state :initial do
31
- event :progress, :transitions_to => :last
32
- end
33
- state :last
18
+ exec "INSERT INTO bookings(title, workflow_state, workflow_type) VALUES('booking1', 'initial', 'workflow_1')"
19
+ exec "INSERT INTO bookings(title, workflow_state, workflow_type) VALUES('booking2', 'initial', 'workflow_2')"
20
+
21
+ class Booking < ActiveRecord::Base
22
+ include Workflow
23
+
24
+ def initialize_workflow
25
+ # define workflow per object instead of per class
26
+ case workflow_type
27
+ when 'workflow_1'
28
+ class << self
29
+ include Workflow
30
+ workflow do
31
+ state :initial do
32
+ event :progress, :transitions_to => :last
34
33
  end
34
+ state :last
35
35
  end
36
- when 'workflow_2'
37
- class << self
38
- include Workflow
39
- workflow do
40
- state :initial do
41
- event :progress, :transitions_to => :intermediate
42
- end
43
- state :intermediate
44
- state :last
36
+ end
37
+ when 'workflow_2'
38
+ class << self
39
+ include Workflow
40
+ workflow do
41
+ state :initial do
42
+ event :progress, :transitions_to => :intermediate
45
43
  end
44
+ state :intermediate
45
+ state :last
46
46
  end
47
47
  end
48
48
  end
49
+ end
49
50
 
50
- def metaclass; class << self; self; end; end
51
-
52
- def workflow_spec
53
- metaclass.workflow_spec
54
- end
51
+ def metaclass; class << self; self; end; end
55
52
 
53
+ def workflow_spec
54
+ metaclass.workflow_spec
56
55
  end
57
56
 
58
- if RUBY_PLATFORM == 'java'
59
- # This test fails on jruby...
60
- # ...not sure why, but all the class << self stuff above looks fishy
61
- nil
62
- else
63
- booking1 = Booking.find_by_title('booking1')
64
- booking1.initialize_workflow
57
+ end
65
58
 
66
- booking2 = Booking.find_by_title('booking2')
67
- booking2.initialize_workflow
59
+ booking1 = Booking.find_by_title('booking1')
60
+ booking1.initialize_workflow
68
61
 
69
- assert booking1.initial?
70
- booking1.progress!
71
- assert booking1.last?, 'booking1 should transition to the "last" state'
62
+ booking2 = Booking.find_by_title('booking2')
63
+ booking2.initialize_workflow
72
64
 
73
- assert booking2.initial?
74
- booking2.progress!
75
- assert booking2.intermediate?, 'booking2 should transition to the "intermediate" state'
65
+ assert booking1.initial?
66
+ booking1.progress!
67
+ assert booking1.last?, 'booking1 should transition to the "last" state'
76
68
 
77
- assert booking1.workflow_spec, 'can access the individual workflow specification'
78
- assert_equal 2, booking1.workflow_spec.states.length
79
- assert_equal 3, booking2.workflow_spec.states.length
80
- end
81
- end
69
+ assert booking2.initial?
70
+ booking2.progress!
71
+ assert booking2.intermediate?, 'booking2 should transition to the "intermediate" state'
82
72
 
83
- class Object
84
- # The hidden singleton lurks behind everyone
85
- def metaclass; class << self; self; end; end
86
- end
73
+ assert booking1.workflow_spec, 'can access the individual workflow specification'
74
+ assert_equal 2, booking1.workflow_spec.states.length
75
+ assert_equal 3, booking2.workflow_spec.states.length
76
+ end
87
77
 
78
+ class Object
79
+ # The hidden singleton lurks behind everyone
80
+ def metaclass; class << self; self; end; end
88
81
  end
82
+
89
83
  end
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.summary = "Add Mongoid support to the Workflow gem."
15
15
  s.description = "Lets you use the Workflow gem with your Mongoid documents to add state machine functionality."
16
16
 
17
- s.add_dependency "workflow", '~>0.8'
17
+ s.add_dependency "workflow", '~>1.0'
18
18
  s.add_dependency "mongoid"
19
19
 
20
20
  s.add_development_dependency "rake"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workflow_on_mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.7
4
+ version: 1.0.0.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: 2012-12-11 00:00:00.000000000 Z
12
+ date: 2013-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: workflow
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0.8'
21
+ version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '0.8'
29
+ version: '1.0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: mongoid
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  version: 1.3.7
157
157
  requirements: []
158
158
  rubyforge_project:
159
- rubygems_version: 1.8.24
159
+ rubygems_version: 1.8.23
160
160
  signing_key:
161
161
  specification_version: 3
162
162
  summary: Add Mongoid support to the Workflow gem.