Sha256: 4726305df18a4a445bc238096874bb09ed6ce924f75f25cdeabc7ba673e50ca4

Contents?: true

Size: 1.41 KB

Versions: 13

Compression:

Stored size: 1.41 KB

Contents

#!/usr/bin/env ruby

require 'helpers'

require 'tempfile'
require 'logger'
require 'fileutils'
require 'rspec'

require 'configurability'
require 'configurability/deferred_config'


#####################################################################
###	C O N T E X T S
#####################################################################
describe Configurability::DeferredConfig do

	after( :each ) do
		Configurability.configurable_objects.clear
		Configurability.reset
	end


	it "calls Configurability.install_config with itself when a 'configure' method is defined" do
		config = { :testing => :testing_config }
		Configurability.configure_objects( config )

		a_class = Class.new do
			extend Configurability::DeferredConfig
			class << self; attr_accessor :config_object; end
			def self::config_key; "testing"; end
			def self::configure( config )
				self.config_object = config
			end
		end

		expect( a_class.config_object ).to be( :testing_config )
	end


	it "includes defaults when configuring" do
		config = { :testing => :testing_config }
		Configurability.configure_objects( config )

		a_class = Class.new do
			extend Configurability::DeferredConfig
			class << self; attr_accessor :config_object; end
			def self::config_key; "testing"; end
			def self::configure( config )
				self.config_object = config
			end
		end

		expect( a_class.config_object ).to be( :testing_config )
	end

end

# vim: set nosta noet ts=4 sw=4:

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
configurability-4.2.0 spec/configurability/deferred_config_spec.rb
configurability-4.1.0 spec/configurability/deferred_config_spec.rb
configurability-4.0.0 spec/configurability/deferred_config_spec.rb
configurability-3.4.1 spec/configurability/deferred_config_spec.rb
configurability-3.3.0 spec/configurability/deferred_config_spec.rb
configurability-3.2.0 spec/configurability/deferred_config_spec.rb
configurability-3.2.0.pre20170417124946 spec/configurability/deferred_config_spec.rb
configurability-3.1.2 spec/configurability/deferred_config_spec.rb
configurability-3.1.1 spec/configurability/deferred_config_spec.rb
configurability-3.1.0 spec/configurability/deferred_config_spec.rb
configurability-3.1.0.pre20170103085451 spec/configurability/deferred_config_spec.rb
configurability-3.0.0 spec/configurability/deferred_config_spec.rb
configurability-3.0.0.pre20161130174408 spec/configurability/deferred_config_spec.rb