Sha256: 92bf8b4059205091b09cb95557c5be37c95f5c04b9b4e1f4d97d31a8a288fcbf
Contents?: true
Size: 1.21 KB
Versions: 6
Compression:
Stored size: 1.21 KB
Contents
require "spec_helper" describe ActiveEnum do describe ".define" do it 'should define enum constants using block' do ActiveEnum.define do enum(:foo) do value :id => 1, :name => 'Foo 1' end enum(:bar) do value :id => 1, :name => 'Bar 1' end end Foo.all.should == [[1,'Foo 1']] Bar.all.should == [[1,'Bar 1']] end end describe ".setup" do before :all do @original = ActiveEnum.use_name_as_value end it 'should pass module into block as configuration object' do ActiveEnum.use_name_as_value.should be_false ActiveEnum.setup {|config| config.use_name_as_value = true } ActiveEnum.use_name_as_value.should be_true end after :all do ActiveEnum.use_name_as_value = @original end end describe ".extend_classes!" do it 'should add enumerate extensions to given classes' do ActiveEnum.extend_classes = [NotActiveRecord] NotActiveRecord.should_not respond_to(:enumerate) ActiveEnum.extend_classes! NotActiveRecord.should respond_to(:enumerate) end end it 'should use the memory store by default' do ActiveEnum.storage.should == :memory end end
Version data entries
6 entries across 6 versions & 1 rubygems