Sha256: 54d06773d83e83479f9b078187a67a8658d065319caf7f8e300e8bc22ff92638

Contents?: true

Size: 611 Bytes

Versions: 6

Compression:

Stored size: 611 Bytes

Contents

require 'spec_helper'

describe 'a module with configuration rules' do
  subject do
    Module.new do
      include GemConfig::Base

      with_configuration do
        has :foo, classes: String
        has :bar, classes: Numeric, default: 1
        has :baz, values: %w(lorem ipsum dolor), default: 'lorem'
      end
    end
  end

  it 'can be configured' do
    expect do
      subject.configure do |config|
        config.foo = 'bar'
        config.baz = 'ipsum'
      end
    end.to_not raise_error

    subject.configuration.foo.should eq('bar')
    subject.configuration.baz.should eq('ipsum')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gem_config-0.3.0 spec/features/configuration_spec.rb
gem_config-0.2.4 spec/features/configuration_spec.rb
gem_config-0.2.3 spec/features/configuration_spec.rb
gem_config-0.2.2 spec/features/configuration_spec.rb
gem_config-0.2.1 spec/features/configuration_spec.rb
gem_config-0.1.0 spec/features/configuration_spec.rb