Sha256: 54a20e60f4cac4a28163e7bca4f5c17069efc973f2dd099f2d217788ac0ecf8c

Contents?: true

Size: 1.19 KB

Versions: 9

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'
require 'capistrano'

describe "AutoTagger Capistrano recipes" do

  describe "create_ref" do
    before do
      @auto_tagger = mock(AutoTagger::Base)
      AutoTagger::Base.should_receive(:new).and_return(@auto_tagger)
      
      @config = Capistrano::Configuration.instance = Capistrano::Configuration.new
      @config.load "lib/auto_tagger/recipes"
      @config.stub(:real_revision).and_return("REAL_REVISION")

      @ref = mock(:name => "TAG", :sha => "SHA")
    end
    
    it "creates a tag from the real_revision when :auto_tagger_stage is set" do
      @auto_tagger.should_receive(:create_ref).with("REAL_REVISION").and_return(@ref)
      @config.set :auto_tagger_stage, :ci
      @config.auto_tagger.create_ref
    end
    
    it "creates a tag from the real_revision when :stage is set" do
      @auto_tagger.should_receive(:create_ref).with("REAL_REVISION").and_return(@ref)
      @config.set :stage, :ci
      @config.auto_tagger.create_ref
    end
    
    it "creates a tag from HEAD when neither :auto_tagger_stage nor :stage are set" do
      @auto_tagger.should_receive(:create_ref).with(no_args).and_return(@ref)
      @config.auto_tagger.create_ref
    end
  end
  
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
auto_tagger-0.2.11 spec/auto_tagger/recipes_spec.rb
auto_tagger-0.2.10 spec/auto_tagger/recipes_spec.rb
auto_tagger-0.2.9 spec/auto_tagger/recipes_spec.rb
auto_tagger-0.2.8 spec/auto_tagger/recipes_spec.rb
auto_tagger-0.2.7 spec/auto_tagger/recipes_spec.rb
auto_tagger-0.2.6 spec/auto_tagger/recipes_spec.rb
auto_tagger-0.2.5 spec/auto_tagger/recipes_spec.rb
auto_tagger-0.2.4 spec/auto_tagger/recipes_spec.rb
auto_tagger-0.2.3 spec/auto_tagger/recipes_spec.rb