Sha256: 3478ba1b863af6cfa5b4b5e4cc15095cab94aa0f1e54ace4de50f9dd443f1e94

Contents?: true

Size: 987 Bytes

Versions: 3

Compression:

Stored size: 987 Bytes

Contents

require 'spec_helper'

describe ConfigureMe::Identity do
  before {
    @parent_class = define_test_class('ParentConfig', ConfigureMe::Base)
    @nested_class = define_test_class('NestedConfig', ConfigureMe::Base)
  }

  context 'a root class' do
    subject { @parent_class.instance }
    it { should respond_to(:config_key) }
    it { should respond_to(:config_name) }
    it { should respond_to(:storage_key) }
    its(:config_name) { should eql('parent') }
    its(:config_key) { should eql('parent') }
    it 'should generate a valid storage key' do
      subject.storage_key('foo').should eql('parent-foo')
    end
  end

  context 'a nested class' do
    before { @nested_class.send(:nest_me, @parent_class) }
    subject { @nested_class.instance }
    its(:config_name) { should eql('nested') }
    its(:config_key) { should eql('parent-nested') }
    it 'should generate a valid storage key' do
      subject.storage_key('foo').should eql('parent-nested-foo')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
configure_me-0.5.0 spec/configure_me/identity_spec.rb
configure_me-0.4.1 spec/configure_me/identity_spec.rb
configure_me-0.4.0 spec/configure_me/identity_spec.rb