enumerate_it 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -12,6 +12,7 @@ tmtags
12
12
 
13
13
  ## VIM
14
14
  *.swp
15
+ tags
15
16
 
16
17
  ## PROJECT::GENERAL
17
18
  coverage
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enumerate_it (0.7.5)
4
+ enumerate_it (0.7.6)
5
5
  activesupport (>= 2.3.2)
6
6
 
7
7
  GEM
@@ -137,11 +137,11 @@ This will create:
137
137
 
138
138
  * If you pass the :create_scopes option as 'true', it will create a scope method for each enumeration option (this option defaults to false):
139
139
 
140
- class Person < ActiveRecord::Base
141
- has_enumeration_for :relationship_status, :with => RelationshipStatus, :create_scopes => true
142
- end
140
+ class Person < ActiveRecord::Base
141
+ has_enumeration_for :relationship_status, :with => RelationshipStatus, :create_scopes => true
142
+ end
143
143
 
144
- Person.married.to_sql # => SELECT "people".* FROM "people" WHERE "people"."relationship_status" = 1
144
+ Person.married.to_sql # => SELECT "people".* FROM "people" WHERE "people"."relationship_status" = 1
145
145
 
146
146
  NOTE: The :create_scopes option can only be used for Rails.version >= 3.0.0.
147
147
 
@@ -254,7 +254,7 @@ module EnumerateIt
254
254
  end
255
255
 
256
256
  def enumerations
257
- @@_enumerations ||= {}
257
+ @_enumerations ||= {}
258
258
  end
259
259
 
260
260
  private
@@ -1,4 +1,4 @@
1
1
  module EnumerateIt
2
- VERSION = "0.7.6"
2
+ VERSION = "0.7.7"
3
3
  end
4
4
 
@@ -26,6 +26,15 @@ class TestEnumerationWithExtendedBehaviour < EnumerateIt::Base
26
26
  end
27
27
  end
28
28
 
29
+ class Foobar < EnumerateIt::Base
30
+ associate_values(
31
+ :bar => 'foo'
32
+ )
33
+ end
34
+ class BaseClass
35
+ include EnumerateIt
36
+ has_enumeration_for :foobar, :with => TestEnumeration
37
+ end
29
38
  describe EnumerateIt do
30
39
  before :each do
31
40
  class TestClass
@@ -57,6 +66,19 @@ describe EnumerateIt do
57
66
  it "stores the enumeration class in a class-level hash" do
58
67
  TestClass.enumerations[:foobar].should == TestEnumeration
59
68
  end
69
+ context 'declaring a simple enum on an inherited class' do
70
+ before do
71
+ class SomeClass < BaseClass
72
+ has_enumeration_for :foobar
73
+ end
74
+ @target = SomeClass.new
75
+ end
76
+ it 'should have use the corret class' do
77
+ @base = BaseClass.new
78
+ @base.class.enumerations[:foobar].should == TestEnumeration
79
+ @target.class.enumerations[:foobar].should == Foobar
80
+ end
81
+ end
60
82
 
61
83
  context "passing the value of each option without the human string (just the value, without an array)" do
62
84
  before :each do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: enumerate_it
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.7.6
5
+ version: 0.7.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - "C\xC3\xA1ssio Marques"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-24 00:00:00 -03:00
13
+ date: 2011-04-29 00:00:00 -03:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency