Permalink
Browse files

tests for string conversions

  • Loading branch information...
1 parent 3c69ac8 commit fc2626b6abf41b950a7f91c39d1ca9c33cc37529 @tloszko committed Feb 27, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 spec/acts_as_enumable/model_additions_spec.rb
@@ -63,6 +63,20 @@ def role=(val)
user.send(:read_attribute, :status).should == 1
user.status.should == :inactive
end
+
+ it "accepts assigns correctly when given role is string" do
+ user = User.new
+ user.role.should be_nil
+ user.status.should be_nil
+
+ [:admin, :staff, :helper, :member].each_with_index do |role,i|
+
+ user.role = role.to_s
+ user.send(:read_attribute, :role).should == i
+ user.role.should == role
+ end
+
+ end
it "handles incorrect enum values" do
user = User.new

0 comments on commit fc2626b

Please sign in to comment.