Sha256: 6145177fc18f2d787dcd00068d77fefa86ab4f8ac446573996026c1805356a99

Contents?: true

Size: 704 Bytes

Versions: 4

Compression:

Stored size: 704 Bytes

Contents

describe Enum do
  describe 'using options' do
    
    # Sample for use below
    module OptionTest
      enum :alpha, 5
      enum :beta,  10
      enum :gamma, 20, 'Monkeys'
    end

    it 'should return name + values as options array' do
      OptionTest.options.should == [['Alpha', 5], ['Beta', 10], ['Monkeys', 20]]
    end
    
    it 'should enable getting options array subset' do
      OptionTest.options(:gamma, :beta).should == [['Monkeys', 20], ['Beta', 10]]
    end
    
    it 'should return no options for nil' do
      OptionTest.options(nil).should == []
    end
    
    it 'should return no options for empty set' do
      OptionTest.options([]).should == []
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iron-enum-1.0.5 spec/enum/option_spec.rb
iron-enum-1.0.4 spec/enum/option_spec.rb
iron-enum-1.0.3 spec/enum/option_spec.rb
iron-enum-1.0.2 spec/enum/option_spec.rb