Sha256: 55511690de1b28b3826359188b5667d4acf9d8268e0721d689d14d417c9f6958

Contents?: true

Size: 1.14 KB

Versions: 11

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
require 'blazing/recipe'

describe Blazing::Recipe do

  describe '.init_by_name' do
    before :each do
      class Blazing::Recipe::Dummy < Blazing::Recipe
        def run(target_options = {})
          super target_options
        end
      end
    end

    it 'initializes the correct recipe' do
      Blazing::Recipe.init_by_name(:dummy).should be_a Blazing::Recipe::Dummy
    end
  end

  describe '.list' do
    it 'retunrs an array of the available recipe classes' do
      Blazing::Recipe.list.should include Blazing::Recipe::Dummy
    end
  end

  describe '#run' do

    before :each do
      @production_url = '/some/target'
      @dummy_recipe = Blazing::Recipe::Dummy.new(:some_option => 'global')
      @config = Blazing::Config.new
      @config.target(:production, @production_url, :some_option => 'target-specific')
      @config.instance_variable_set('@recipes', [@dummy_recipe])
    end

    it 'overrides global recipe options with target options' do
      @dummy_recipe.run(:some_option => 'target-specific')
      @dummy_recipe.instance_variable_get('@options')[:some_option].should == 'target-specific'
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
blazing-0.4.2 spec/blazing/recipe_spec.rb
blazing-0.4.1 spec/blazing/recipe_spec.rb
blazing-0.4.0 spec/blazing/recipe_spec.rb
blazing-0.4.0.beta3 spec/blazing/recipe_spec.rb
blazing-0.4.0.beta2 spec/blazing/recipe_spec.rb
blazing-0.4.0.beta1 spec/blazing/recipe_spec.rb
blazing-0.3.0 spec/blazing/recipe_spec.rb
blazing-0.2.14 spec/blazing/recipe_spec.rb
blazing-0.2.13 spec/blazing/recipe_spec.rb
blazing-0.2.12 spec/blazing/recipe_spec.rb
blazing-0.2.11 spec/blazing/recipe_spec.rb