Sha256: 844e39becdf0197a3e206ace42768df1afeebdf68b7dc0c3abc93f137f72455a

Contents?: true

Size: 941 Bytes

Versions: 3

Compression:

Stored size: 941 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper')

configatron.foo.bar = :bar
configatron.a.b.c.d = 'D'

configatron.cachetastic.foo.bar = 'cachetastic-fubar'
configatron.l.m.n.o.p = 'P'

class Foo
end

module A
  module B
    class C
    end
  end
end

module N
  class O
  end
end

describe Class do
  
  describe 'to_configatron' do
    
    it 'should return a Configatron::Store object based on the name of the class' do
      Foo.to_configatron.should be_kind_of(Configatron::Store)
      Foo.to_configatron.bar.should == :bar
      A::B::C.to_configatron.d.should == 'D'
    end
    
    it 'should take an array to prepend to the object' do
      Foo.to_configatron(:cachetastic).bar.should == 'cachetastic-fubar'
      N::O.to_configatron(:l, 'm').p.should == 'P'
    end
    
    it 'should convert a string to a Store object' do
      'A::B::C'.to_configatron.d.should == configatron.a.b.c.d
    end
    
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
configatron-2.12.0 spec/lib/class_spec.rb
configatron-2.11.0 spec/lib/class_spec.rb
configatron-2.10.0 spec/lib/class_spec.rb