Sha256: 611c40872b4360a27ba063a7d4670752bd16ea000b5a4c245acd1bb413909e6c

Contents?: true

Size: 1.31 KB

Versions: 8

Compression:

Stored size: 1.31 KB

Contents

require File.expand_path("../spec_helper", File.dirname(__FILE__))

describe Sprinkle::Configurable do
  module MyPrefix
    class Configurable
      include Sprinkle::Configurable
    end
  end
  
  before do
    @configurable = MyPrefix::Configurable.new
    @default = Proc.new { }
    @defaults = { :configurable => @default }
    @deployment = Object.new
    @deployment.stub!(:defaults).and_return(@defaults)
    @deployment.stub!(:style)
  end

  it 'should be configurable via external defaults' do
    @configurable.should respond_to(:defaults)
  end

  it 'should select the defaults for the particular concrete installer class' do
    @deployment.should_receive(:defaults).and_return(@defaults)
    @defaults.should_receive(:[]).with(:configurable).and_return(@default)
  end

  it 'should configure the installer delivery mechansim' do
    @configurable.should_receive(:instance_eval)
  end

  it 'should maintain an options hash set arbitrarily via method missing' do
    @configurable.instance_eval do
      hsv 'gts'
    end
    @configurable.hsv.first.should == 'gts'
  end
  
  it 'should allow the delivery instance variable to be accessed' do
    @configurable.delivery = "string"
    @configurable.instance_variable_get(:@delivery).should eql("string")
  end

  after do
    @configurable.defaults(@deployment)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sprinkle-0.5.2 spec/sprinkle/configurable_spec.rb
sprinkle-0.5.1.1 spec/sprinkle/configurable_spec.rb
sprinkle-0.5.1 spec/sprinkle/configurable_spec.rb
sprinkle-0.5.0 spec/sprinkle/configurable_spec.rb
sprinkle-0.5.0.rc1 spec/sprinkle/configurable_spec.rb
sprinkle-0.4.2 spec/sprinkle/configurable_spec.rb
sprinkle-0.4.1 spec/sprinkle/configurable_spec.rb
sprinkle-0.4.0 spec/sprinkle/configurable_spec.rb