spec/mongoid/enum_spec.rb in mongoid-enum-i18n-0.3.3 vs spec/mongoid/enum_spec.rb in mongoid-enum-i18n-0.5.0

- old
+ new

@@ -83,10 +83,15 @@ it 'accepts strings' do instance.status = 'banned' expect(instance.status).to eq :banned end + it 'accepts empty string as nil' do + instance.status = '' + expect(instance.status).to be_nil + end + it 'accepts symbols' do instance.status = :banned expect(instance.status).to eq :banned end end @@ -239,9 +244,14 @@ expect(instance.status_i18n).to eq('Awaiting Approval') end it 'should have a helper to translate the enum' do instance.status = nil + expect(instance.status_i18n).to be_nil + end + + it 'should have a helper to translate the enum with empty' do + instance.status = '' expect(instance.status_i18n).to be_nil end it 'should return nil when enum is nil' do expect(instance.roles_i18n).to be_nil