enumify 0.0.6 → 0.0.7

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: 6e07e879db1b0841f3709bb38a18a6e1ebf6ca9d
4
- data.tar.gz: 16564aef554f7f9b5ec758ebc05c8773b0491255
3
+ metadata.gz: afa463a12776e37c4f2051d7fe8b9a4d7e47aa91
4
+ data.tar.gz: be3ae8cae94d3b0ec6cf3a4d14e6253d5a1e8f10
5
5
  SHA512:
6
- metadata.gz: 25f74bc2d96ac0c98113836d512193afc297b5f00ef2e7f342749cd5a4a0390449e5b59e55f67bd8f04542e10e80c11f6db6bc405007ce53f68d3509b3b6f601
7
- data.tar.gz: ab1a202e1104bd2d7dd84e6bfadae9e40a46b310664ca73152e2c859a1bedb3a7955e530ee25453a0f3f762cd974a096fb3011ff5ea48fdb671f831b9cf40b23
6
+ metadata.gz: 282293fed0da633d2f434c84eb3390e3bcb5a5f9bb07a4dc8e09dc4a9c60dfa65ef8191e4cf8045da4ad1a75b7dcef0fad2dd5da6caf4b9334130708b7ccb841
7
+ data.tar.gz: cd1e855fba1d4e1a51ce67394c519cb1f2e57464224807b02d17d608007a205658e5c6ac7266a55cfea9cf341bda413790940bdc364ff488fa769223a1c9b36c
data/Appraisals CHANGED
@@ -1,7 +1,7 @@
1
1
  appraise "rails30" do
2
2
  gem 'rubysl', '~> 2.0', :platforms => :rbx
3
3
  gem 'rubinius-developer_tools', :platforms => :rbx
4
- gem 'sqlite3', :platforms => [:ruby, :rbx]
4
+ gem 'sqlite3', '1.3.8' , :platforms => [:ruby, :rbx]
5
5
  gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
6
6
 
7
7
  gem "activerecord", "~> 3.0.11"
@@ -10,7 +10,7 @@ end
10
10
  appraise "rails31" do
11
11
  gem 'rubysl', '~> 2.0', :platforms => :rbx
12
12
  gem 'rubinius-developer_tools', :platforms => :rbx
13
- gem 'sqlite3', :platforms => [:ruby, :rbx]
13
+ gem 'sqlite3', '1.3.8' , :platforms => [:ruby, :rbx]
14
14
  gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
15
15
 
16
16
  gem "activerecord", "~> 3.1.12"
@@ -19,7 +19,7 @@ end
19
19
  appraise "rails32" do
20
20
  gem 'rubysl', '~> 2.0', :platforms => :rbx
21
21
  gem 'rubinius-developer_tools', :platforms => :rbx
22
- gem 'sqlite3', :platforms => [:ruby, :rbx]
22
+ gem 'sqlite3', '1.3.8' , :platforms => [:ruby, :rbx]
23
23
  gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
24
24
 
25
25
  gem "activerecord", "~> 3.2.14"
@@ -28,7 +28,7 @@ end
28
28
  appraise "rails40" do
29
29
  gem 'rubysl', '~> 2.0', :platforms => :rbx
30
30
  gem 'rubinius-developer_tools', :platforms => :rbx
31
- gem 'sqlite3', :platforms => [:ruby, :rbx]
31
+ gem 'sqlite3', '1.3.8' , :platforms => [:ruby, :rbx]
32
32
  gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
33
33
 
34
34
  gem "activerecord", "~> 4.0.0"
@@ -37,8 +37,8 @@ end
37
37
  appraise "rails41" do
38
38
  gem 'rubysl', '~> 2.0', :platforms => :rbx
39
39
  gem 'rubinius-developer_tools', :platforms => :rbx
40
- gem 'sqlite3', :platforms => [:ruby, :rbx]
40
+ gem 'sqlite3', '1.3.8' , :platforms => [:ruby, :rbx]
41
41
  gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
42
42
 
43
- gem "activerecord", "~> 4.1.0.beta1"
44
- end
43
+ gem "activerecord", "~> 4.1.0"
44
+ end
@@ -1,3 +1,6 @@
1
+ ## v0.0.7
2
+ * Fixed an issue with setting an enum as a nil value
3
+
1
4
  ## v0.0.6
2
5
  * Calling method! will not trigger a save if the value had not changed
3
6
 
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source "http://rubygems.org"
2
2
 
3
3
  gem 'rubysl', '~> 2.0', :platforms => :rbx
4
4
  gem 'rubinius-developer_tools', :platforms => :rbx
5
- gem 'sqlite3', :platforms => [:ruby, :rbx]
5
+ gem 'sqlite3', '1.3.8', :platforms => [:ruby, :rbx]
6
6
  gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
7
7
 
8
8
  # Specify your gem's dependencies in enumify.gemspec
@@ -2,11 +2,10 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
+ gem "rubysl", "~> 2.0", :platforms=>:rbx
6
+ gem "rubinius-developer_tools", :platforms=>:rbx
7
+ gem "sqlite3", "1.3.8", :platforms=>[:ruby, :rbx]
8
+ gem "activerecord-jdbcsqlite3-adapter", :platforms=>:jruby
5
9
  gem "activerecord", "~> 3.0.11"
6
10
 
7
- gem 'rubysl', '~> 2.0', :platforms => :rbx
8
- gem 'rubinius-developer_tools', :platforms => :rbx
9
- gem 'sqlite3', :platforms => [:ruby, :rbx]
10
- gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
11
-
12
11
  gemspec :path=>"../"
@@ -2,11 +2,10 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
+ gem "rubysl", "~> 2.0", :platforms=>:rbx
6
+ gem "rubinius-developer_tools", :platforms=>:rbx
7
+ gem "sqlite3", "1.3.8", :platforms=>[:ruby, :rbx]
8
+ gem "activerecord-jdbcsqlite3-adapter", :platforms=>:jruby
5
9
  gem "activerecord", "~> 3.1.12"
6
10
 
7
- gem 'rubysl', '~> 2.0', :platforms => :rbx
8
- gem 'rubinius-developer_tools', :platforms => :rbx
9
- gem 'sqlite3', :platforms => [:ruby, :rbx]
10
- gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
11
-
12
11
  gemspec :path=>"../"
@@ -2,11 +2,10 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
+ gem "rubysl", "~> 2.0", :platforms=>:rbx
6
+ gem "rubinius-developer_tools", :platforms=>:rbx
7
+ gem "sqlite3", "1.3.8", :platforms=>[:ruby, :rbx]
8
+ gem "activerecord-jdbcsqlite3-adapter", :platforms=>:jruby
5
9
  gem "activerecord", "~> 3.2.14"
6
10
 
7
- gem 'rubysl', '~> 2.0', :platforms => :rbx
8
- gem 'rubinius-developer_tools', :platforms => :rbx
9
- gem 'sqlite3', :platforms => [:ruby, :rbx]
10
- gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
11
-
12
11
  gemspec :path=>"../"
@@ -2,11 +2,10 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
+ gem "rubysl", "~> 2.0", :platforms=>:rbx
6
+ gem "rubinius-developer_tools", :platforms=>:rbx
7
+ gem "sqlite3", "1.3.8", :platforms=>[:ruby, :rbx]
8
+ gem "activerecord-jdbcsqlite3-adapter", :platforms=>:jruby
5
9
  gem "activerecord", "~> 4.0.0"
6
10
 
7
- gem 'rubysl', '~> 2.0', :platforms => :rbx
8
- gem 'rubinius-developer_tools', :platforms => :rbx
9
- gem 'sqlite3', :platforms => [:ruby, :rbx]
10
- gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
11
-
12
11
  gemspec :path=>"../"
@@ -2,11 +2,10 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 4.1.0.beta1"
5
+ gem "rubysl", "~> 2.0", :platforms=>:rbx
6
+ gem "rubinius-developer_tools", :platforms=>:rbx
7
+ gem "sqlite3", "1.3.8", :platforms=>[:ruby, :rbx]
8
+ gem "activerecord-jdbcsqlite3-adapter", :platforms=>:jruby
9
+ gem "activerecord", "~> 4.1.0"
6
10
 
7
- gem 'rubysl', '~> 2.0', :platforms => :rbx
8
- gem 'rubinius-developer_tools', :platforms => :rbx
9
- gem 'sqlite3', :platforms => [:ruby, :rbx]
10
- gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
11
-
12
- gemspec :path=>"../"
11
+ gemspec :path=>"../"
@@ -21,10 +21,10 @@ module Enumify
21
21
 
22
22
  define_method "_set_#{parameter.to_s}" do |value, should_save|
23
23
 
24
- value = value.to_sym
24
+ value = value and value.to_sym
25
25
  old = read_attribute(parameter) ? read_attribute(parameter).to_sym : nil
26
26
  return value if old == value
27
- write_attribute(parameter, value.to_s)
27
+ write_attribute(parameter, (value and value.to_s))
28
28
  save if should_save
29
29
  send("#{parameter.to_s}_changed", old, value) if respond_to?("#{parameter.to_s}_changed", true) and !old.nil?
30
30
  return value
@@ -36,11 +36,11 @@ module Enumify
36
36
  raise "Collision in enum values method #{val}" if respond_to?("#{val.to_s}?") or respond_to?("#{val.to_s}!") or respond_to?("#{val.to_s}")
37
37
 
38
38
  define_method "#{val.to_s}?" do
39
- send("#{parameter.to_s}") == val
39
+ send("#{parameter.to_s}") == val
40
40
  end
41
41
 
42
42
  define_method "#{val.to_s}!" do
43
- send("_set_#{parameter.to_s}", val, true)
43
+ send("_set_#{parameter.to_s}", val, true)
44
44
  end
45
45
 
46
46
  scope val.to_sym, lambda { where(parameter.to_sym => val.to_s) }
@@ -1,3 +1,3 @@
1
1
  module Enumify
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
@@ -48,15 +48,31 @@ describe :Enumify do
48
48
  end
49
49
 
50
50
  describe "model allowing enum value to be nil" do
51
+ subject { @obj_allowing_nil }
51
52
  it "should be valid" do
52
- @obj_allowing_nil.should be_valid
53
+ subject.should be_valid
53
54
  end
54
55
 
56
+ it 'should not raise error when setting value to nil' do
57
+ expect {
58
+ subject.status = nil
59
+ }.to_not raise_error
60
+
61
+ subject.status.should be_nil
62
+ end
55
63
  end
56
64
 
57
65
  describe "model not allowing enum value to be nil" do
66
+ subject { @obj_not_allowing_nil }
58
67
  it "should be invalid" do
59
- @obj_not_allowing_nil.should be_invalid
68
+ subject.should be_invalid
69
+ end
70
+
71
+ it 'should not raise error when setting value to nil' do
72
+ expect {
73
+ subject.status = nil
74
+ }.to_not raise_error
75
+ subject.should be_invalid
60
76
  end
61
77
  end
62
78
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enumify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - yon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake