Sha256: 3a119b1405a19eeafb619557d119b37283ca2de02976529ad1a0a2d935ad738c

Contents?: true

Size: 1.83 KB

Versions: 96

Compression:

Stored size: 1.83 KB

Contents

require "utils"
require 'capistrano/recipes/deploy/scm/base'

class DeploySCMBaseTest < Test::Unit::TestCase
  class TestSCM < Capistrano::Deploy::SCM::Base
    default_command "floopy"
  end

  def setup
    @config = { }
    def @config.exists?(name); key?(name); end

    @source = TestSCM.new(@config)
  end

  def test_command_should_default_to_default_command
    assert_equal "floopy", @source.command
    @source.local { assert_equal "floopy", @source.command }
  end

  def test_command_should_use_scm_command_if_available
    @config[:scm_command] = "/opt/local/bin/floopy"
    assert_equal "/opt/local/bin/floopy", @source.command
  end

  def test_command_should_use_scm_command_in_local_mode_if_local_scm_command_not_set
    @config[:scm_command] = "/opt/local/bin/floopy"
    @source.local { assert_equal "/opt/local/bin/floopy", @source.command }
  end

  def test_command_should_use_local_scm_command_in_local_mode_if_local_scm_command_is_set
    @config[:scm_command] = "/opt/local/bin/floopy"
    @config[:local_scm_command] = "/usr/local/bin/floopy"
    assert_equal "/opt/local/bin/floopy", @source.command
    @source.local { assert_equal "/usr/local/bin/floopy", @source.command }
  end

  def test_command_should_use_default_if_scm_command_is_default
    @config[:scm_command] = :default
    assert_equal "floopy", @source.command
  end

  def test_command_should_use_default_in_local_mode_if_local_scm_command_is_default
    @config[:scm_command] = "/foo/bar/floopy"
    @config[:local_scm_command] = :default
    @source.local { assert_equal "floopy", @source.command }
  end

  def test_local_mode_proxy_should_treat_messages_as_being_in_local_mode
    @config[:scm_command] = "/foo/bar/floopy"
    @config[:local_scm_command] = :default
    assert_equal "floopy", @source.local.command
    assert_equal "/foo/bar/floopy", @source.command
  end
end

Version data entries

96 entries across 96 versions & 11 rubygems

Version Path
capistrano-2.15.11 test/deploy/scm/base_test.rb
capistrano-2.15.10 test/deploy/scm/base_test.rb
capistrano-2.15.9 test/deploy/scm/base_test.rb
wulffeld-capistrano-2.5.8.3 test/deploy/scm/base_test.rb
capistrano-2.15.8 test/deploy/scm/base_test.rb
capistrano-2.5.22 test/deploy/scm/base_test.rb
capistrano-2.15.7 test/deploy/scm/base_test.rb
capistrano-2.15.6 test/deploy/scm/base_test.rb
dan-capistrano-2.5.6 test/deploy/scm/base_test.rb
fotonauts-capistrano-2.5.2 test/deploy/scm/base_test.rb
mbailey-capistrano-2.5.5 test/deploy/scm/base_test.rb
mbailey-capistrano-2.5.6 test/deploy/scm/base_test.rb
mbailey-capistrano-2.5.7 test/deploy/scm/base_test.rb
sneakin-capistrano-2.5.5 test/deploy/scm/base_test.rb
thoughtbot-capistrano-2.5.5 test/deploy/scm/base_test.rb
thoughtbot-capistrano-2.5.6 test/deploy/scm/base_test.rb
wulffeld-capistrano-2.5.8.1 test/deploy/scm/base_test.rb
wulffeld-capistrano-2.5.8 test/deploy/scm/base_test.rb
capistrano-2.15.5 test/deploy/scm/base_test.rb
minmb-capistrano-2.15.4 test/deploy/scm/base_test.rb