omg-statelogic 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -3
- data/test/statelogic_test.rb +6 -3
- data/test/test_helper.rb +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
Statelogic is a yet another take on state management for your models.
|
3
3
|
It's tailored specially for ActiveRecord and is different from other
|
4
4
|
frameworks in that it has its main goal in scoping validation rules and
|
5
|
-
callbacks depending on the model's state
|
6
|
-
|
5
|
+
callbacks depending on the model's state to emphasis _actual_ model state
|
6
|
+
consistency over merely formal... whatever...
|
7
7
|
|
8
8
|
=== Features
|
9
9
|
- State transitions validation.
|
@@ -64,7 +64,7 @@ Please report via Github issue tracking.
|
|
64
64
|
|
65
65
|
=== See also
|
66
66
|
* http://github.com/omg/threadpool -- Thread pool implementation
|
67
|
-
* http://github.com/omg/
|
67
|
+
* http://github.com/omg/peanuts -- Ruby <-> XML mapping
|
68
68
|
|
69
69
|
|
70
70
|
Hint: If you feel like generous today you can tip me at http://tipjoy.com/u/pisuka
|
data/test/statelogic_test.rb
CHANGED
@@ -23,9 +23,12 @@ class Order < ActiveRecord::Base
|
|
23
23
|
end
|
24
24
|
|
25
25
|
class OrderTest < ActiveSupport::TestCase
|
26
|
+
include ActiveRecord::TestFixtures
|
27
|
+
self.fixture_path = 'test/fixtures'
|
28
|
+
|
26
29
|
fixtures :orders
|
27
30
|
|
28
|
-
|
31
|
+
should_validate_presence_of :state, :message => default_error_message(:inclusion)
|
29
32
|
|
30
33
|
context 'A fresh order' do
|
31
34
|
setup do
|
@@ -57,7 +60,7 @@ class OrderTest < ActiveSupport::TestCase
|
|
57
60
|
should_allow_values_for :state, 'ready', 'redeemed', 'suspended'
|
58
61
|
should_not_allow_values_for :state, 'unpaid', 'screwed_up',
|
59
62
|
:message => default_error_message(:inclusion)
|
60
|
-
|
63
|
+
should_validate_presence_of :txref
|
61
64
|
should_not_require_attributes :redeemed_at, :facility_id
|
62
65
|
end
|
63
66
|
|
@@ -69,7 +72,7 @@ class OrderTest < ActiveSupport::TestCase
|
|
69
72
|
should_allow_values_for :state, 'redeemed', 'suspended'
|
70
73
|
should_not_allow_values_for :state, 'unpaid', 'ready', 'screwed_up',
|
71
74
|
:message => default_error_message(:inclusion)
|
72
|
-
|
75
|
+
should_validate_presence_of :txref, :redeemed_at, :facility_id
|
73
76
|
end
|
74
77
|
|
75
78
|
context 'A suspended order' do
|
data/test/test_helper.rb
CHANGED
@@ -9,7 +9,7 @@ require 'statelogic/activerecord'
|
|
9
9
|
|
10
10
|
require 'shoulda_macros/statelogic'
|
11
11
|
|
12
|
-
|
12
|
+
#ActiveRecord::TestFixtures.fixture_path = 'test/fixtures'
|
13
13
|
|
14
14
|
ActiveRecord::Base.configurations = {
|
15
15
|
'test' => {:adapter => 'sqlite3', :dbfile => ':memory:'}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omg-statelogic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Gunko
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.
|
23
|
+
version: 2.3.2
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thoughtbot-shoulda
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.10.1
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: sqlite3-ruby
|