Sha256: 9d927f5350ac7670165b9c423247ad1cf041df44b6c4c9c8d08e807f201e78c2
Contents?: true
Size: 811 Bytes
Versions: 6
Compression:
Stored size: 811 Bytes
Contents
describe Enum do describe 'using names' do # Sample for use below module NameTest enum :a_long_key, 1 enum :custom_name, 2, 'Wahoo' enum :singleton, 3 end it 'should return a name from a value' do NameTest.name(3).should == 'Singleton' end it 'should return all names in order' do NameTest.names.should == ['A Long Key', 'Wahoo', 'Singleton'] end it 'should return a set of names from a set of keys or values' do NameTest.names(2, 1, :singleton).should == ['Wahoo', 'A Long Key', 'Singleton'] end it 'should return nil for the name of nil' do NameTest.name(nil).should be_nil end it 'should keep normal Module#name behavior' do NameTest.name.should == 'NameTest' end end end
Version data entries
6 entries across 6 versions & 1 rubygems