haz_enum 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/haz_enum.gemspec +1 -1
- data/lib/haz_enum/set.rb +1 -1
- data/spec/set_spec.rb +4 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
data/haz_enum.gemspec
CHANGED
data/lib/haz_enum/set.rb
CHANGED
@@ -71,7 +71,7 @@ module HazEnum
|
|
71
71
|
end
|
72
72
|
|
73
73
|
define_method("initialize_#{set_name}_from_yml") do
|
74
|
-
deserialized_value = (YAML::load(self[set_column]) || [])
|
74
|
+
deserialized_value = (YAML::load(self[set_column] || "--- \n") || [])
|
75
75
|
send("#{set_name}=", deserialized_value)
|
76
76
|
end
|
77
77
|
|
data/spec/set_spec.rb
CHANGED
@@ -17,6 +17,10 @@ describe "HazEnum" do
|
|
17
17
|
ClassWithSet.new(:roles => [Roles::User, Roles::Admin]).roles[1].should be(Roles::Admin)
|
18
18
|
end
|
19
19
|
|
20
|
+
it "should have empty array as default-value" do
|
21
|
+
ClassWithSet.new.roles.should == []
|
22
|
+
end
|
23
|
+
|
20
24
|
it "should be able to save values as yml" do
|
21
25
|
YmlSet.new(:roles => [Roles::User, Roles::Admin]).roles[1].should be(Roles::Admin)
|
22
26
|
yml_set = YmlSet.create(:roles => [Roles::User, Roles::Admin])
|