maintain 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.8
1
+ 0.1.9
@@ -21,7 +21,7 @@ module Maintain
21
21
  end
22
22
  # Now define the state
23
23
  if @active_record && method_free?(name, true)
24
- conditions = {:conditions => {@attribute => options.map{|value| states[value]}}}
24
+ conditions = {:conditions => {@attribute => options.map{|value| states[value][:value].is_a?(Symbol) ? states[value][:value].to_s : states[value][:value] }}}
25
25
  if defined?(ActiveRecord::VERSION) && ActiveRecord::VERSION::STRING >= "3"
26
26
  maintainee.scope name, conditions
27
27
  else
data/maintain.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{maintain}
8
- s.version = "0.1.8"
8
+ s.version = "0.1.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Flip Sasser"]
12
- s.date = %q{2010-05-03}
12
+ s.date = %q{2010-05-06}
13
13
  s.description = %q{
14
14
  Maintain is a simple state machine mixin for Ruby objects. It supports comparisons, bitmasks,
15
15
  and hooks that really work. It can be used for multiple attributes and will always do its best to
@@ -34,7 +34,10 @@ if proceed
34
34
  ActiveMaintainTest.maintain :status do
35
35
  state :new, :default => true
36
36
  state :old
37
- aggregate :everything, :as => [:new, :old]
37
+ state :foo
38
+ state :bar
39
+ aggregate :everything, :as => [:new, :old, :foo, :bar]
40
+ aggregate :fakes, :as => [:foo, :bar]
38
41
  end
39
42
  end
40
43
 
@@ -68,6 +71,17 @@ if proceed
68
71
  ActiveMaintainTest.should respond_to(:everything)
69
72
  ActiveMaintainTest.everything.should respond_to(:each)
70
73
  end
74
+
75
+ it "should return the correct collections on aggregates" do
76
+ ActiveMaintainTest.destroy_all
77
+ one = ActiveMaintainTest.create(:status => :foo)
78
+ two = ActiveMaintainTest.create(:status => :bar)
79
+ three = ActiveMaintainTest.create(:status => :new)
80
+ four = ActiveMaintainTest.create(:status => :old)
81
+ ActiveMaintainTest.fakes.should == [one, two]
82
+ ActiveMaintainTest.everything.should == [one, two, three, four]
83
+ end
84
+
71
85
  end
72
86
  end
73
87
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 8
9
- version: 0.1.8
8
+ - 9
9
+ version: 0.1.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Flip Sasser
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-03 00:00:00 -04:00
17
+ date: 2010-05-06 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20