simple_enum 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2ccef9004864a8144f12e09b8f9d3b7337f2a6e
4
- data.tar.gz: 42a62edab3dbf1af37c8368f4eeecfb5d0c5ab5f
3
+ metadata.gz: 15a4d23ebb4c06389cc6567924cd06fdf9120534
4
+ data.tar.gz: 7ae02ee44339aa33f7b2f2e4b80818e5c07b0afe
5
5
  SHA512:
6
- metadata.gz: 1ad263fa8e8705c4534a11f278db11cf564b6ce1371b3f50883d4e4dd41a583492e2e807410d7da63e794d3b110a991d45d2857fb6f8369367d529db879f78c1
7
- data.tar.gz: 913a6473142147a01aecec53ac5ce3ad6b6e0a96aac61898384536383df16b8118a4aa512f1ff8f590866efd9223db066c43c2858d3de955eca704011e124f67
6
+ metadata.gz: c3a157e56f6876c9e62e567fd39b13c30cd1b5a52242eea88eaf4b696119b41f061392792371a3bde550478f4d7cc55eef4041b4128656bdf040cb5d3fcba4b9
7
+ data.tar.gz: 9285798a1feee8f685154a4135d9644fe94ef7ef3911ff863f9305e80fffeaee7217b2a46a614c07f364deed8391cd6ac0c5b94c34e649f9e66118b5d9d58e3c
data/.gitignore CHANGED
@@ -6,4 +6,5 @@ pkg
6
6
  .*.sw?
7
7
  tmp
8
8
  Gemfile.lock
9
+ gemfiles/*.lock
9
10
  :memory*
data/README.md CHANGED
@@ -50,7 +50,7 @@ to use simple_enum with another version of mongoid, use version 1.6 instead.
50
50
  Load mongoid support in the `Gemfile`:
51
51
 
52
52
  ```ruby
53
- gem 'simple_enum', '2.0.0.rc1' , require: 'simple_enum/mongoid'
53
+ gem 'simple_enum', '~> 2.0.0' , require: 'simple_enum/mongoid'
54
54
  ```
55
55
 
56
56
  Add this to a model:
@@ -29,11 +29,11 @@ module SimpleEnum
29
29
  end
30
30
 
31
31
  def changed?(object)
32
- object.attribute_changed?(source)
32
+ object.send(:attribute_changed?, source)
33
33
  end
34
34
 
35
35
  def was(object)
36
- enum.key(object.attribute_was(source))
36
+ enum.key(object.send(:attribute_was, source))
37
37
  end
38
38
 
39
39
  def to_s
@@ -1,5 +1,5 @@
1
1
  module SimpleEnum
2
2
 
3
3
  # The current `SimpleEnum` version.
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.1"
5
5
  end
@@ -159,6 +159,20 @@ describe SimpleEnum::Accessors do
159
159
  expect(object).to receive(:attribute_was).with('gender_cd') { 1 }
160
160
  expect(subject.was(object)).to eq :female
161
161
  end
162
+
163
+ end
164
+ end
165
+
166
+ context 'dirty attributes on ActiveModel', active_record: true do
167
+ fake_active_record(:klass) { as_enum :gender, %w{male female} }
168
+ let(:object) { klass.create(gender: :male) }
169
+
170
+ it 'does not raise error "private method attribute_was called"' do
171
+ object.gender = :female
172
+ expect do
173
+ expect(object.gender_changed?).to be_true
174
+ expect(object.gender_was).to eq :male
175
+ end.to_not raise_error
162
176
  end
163
177
  end
164
178
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_enum
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Westermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-02 00:00:00.000000000 Z
11
+ date: 2014-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport