mattsnyder-stately 0.2.1 → 0.2.2
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/Gemfile.lock +2 -2
- data/lib/stately/state.rb +1 -1
- data/lib/stately/version.rb +1 -1
- data/spec/functional/stately_spec.rb +3 -3
- data/spec/unit/stately/state_spec.rb +7 -0
- metadata +3 -3
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stately (0.2.
|
4
|
+
mattsnyder-stately (0.2.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: http://rubygems.org/
|
@@ -26,9 +26,9 @@ PLATFORMS
|
|
26
26
|
ruby
|
27
27
|
|
28
28
|
DEPENDENCIES
|
29
|
+
mattsnyder-stately!
|
29
30
|
rake
|
30
31
|
rdoc
|
31
32
|
redcarpet (~> 2.2.2)
|
32
33
|
rspec (~> 2.0)
|
33
|
-
stately!
|
34
34
|
yard (~> 0.8.3)
|
data/lib/stately/state.rb
CHANGED
data/lib/stately/version.rb
CHANGED
@@ -4,8 +4,8 @@ require 'spec_helper'
|
|
4
4
|
describe Stately do
|
5
5
|
before do
|
6
6
|
@order_class = Class.new(OpenStruct) do
|
7
|
-
stately :start => :processing do
|
8
|
-
state :completed do
|
7
|
+
stately :start => :processing, :attr => :state do
|
8
|
+
state :completed, :action => :complete do
|
9
9
|
prevent_from :refunded
|
10
10
|
|
11
11
|
before_transition :from => :processing, :do => :before_completed
|
@@ -16,7 +16,7 @@ describe Stately do
|
|
16
16
|
validate :validates_credit_card
|
17
17
|
end
|
18
18
|
|
19
|
-
state :invalid do
|
19
|
+
state :invalid, :action => :invalidate do
|
20
20
|
prevent_from :completed, :refunded
|
21
21
|
end
|
22
22
|
|
@@ -2,6 +2,13 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Stately::State do
|
4
4
|
describe 'initialize' do
|
5
|
+
describe 'with an unrecognized action' do
|
6
|
+
it 'should not have an empty string for an action' do
|
7
|
+
state = Stately::State.new :pending
|
8
|
+
state.action.should == "pending"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
5
12
|
describe 'with a block given' do
|
6
13
|
describe 'new' do
|
7
14
|
before do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mattsnyder-stately
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Twomey
|