spec/mongoid/enum_spec.rb in mongoid-enum-i18n-0.2.9 vs spec/mongoid/enum_spec.rb in mongoid-enum-i18n-0.3.0

- old
+ new

@@ -237,9 +237,23 @@ describe 'i18n' do it 'should have a helper to translate the enum' do 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 return nil when enum is nil' do + expect(instance.roles_i18n).to be_nil + end + + it 'should return nil when enum is nil' do + instance.roles << :author + expect(instance.roles_i18n).to eq ['Author'] + end + it 'should have a helper to translate the values' do expect(User.status_values) .to eq([['Awaiting Approval', :awaiting_approval]]) end end