Sha256: a437d7d6c5fc8e84ac0b74227e9820fbf8794c749087fee83e29929652157b5d

Contents?: true

Size: 441 Bytes

Versions: 6

Compression:

Stored size: 441 Bytes

Contents

describe Enum do
  describe 'with keys' do

    module KeyTest
      enum :key1, 10
      enum :key2, 20
      enum :key3, 5000
    end
    
    it 'should set enum keys as constants' do
      KeyTest::KEY1.should == 10
    end
    
    it 'should convert values to keys' do
      KeyTest.key(20).should == :key2
    end
    
    it 'should return a list of all keys' do
      KeyTest.keys.should == [:key1, :key2, :key3]
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
iron-enum-1.0.5 spec/enum/key_spec.rb
iron-enum-1.0.4 spec/enum/key_spec.rb
iron-enum-1.0.3 spec/enum/key_spec.rb
iron-enum-1.0.2 spec/enum/key_spec.rb
iron-enum-1.0.1 spec/enum/key_spec.rb
iron-enum-1.0.0 spec/enum/key_spec.rb