Sha256: 513b73047d13c2184b916e692b2c9ee1e98438677cf5b0e91ec3b15d38520093

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require File.expand_path '../test_helper.rb', __FILE__

class DeepThoughtCapistranoTest < MiniTest::Unit::TestCase
  def setup
    DatabaseCleaner.start

    if File.directory?(".projects/_test")
      FileUtils.rm_rf(".projects/_test")
    end

    DeepThought::Deploy.any_instance.stubs(:queue)

    @project = DeepThought::Project.create(:name => '_test', :repo_url => './test/fixtures/project-test')
    @user = DeepThought::User.create(:email => 'test@test.com', :password => 'secret', :password_confirmation => 'secret')
    @deploy = DeepThought::Deploy.create(:project_id => @project.id, :user_id => @user.id, :branch => 'master', :commit => '12345')
    @deployer = DeepThought::Deployer::Capistrano2.new
  end

  def teardown
    if File.directory?(".projects/_test")
      FileUtils.rm_rf(".projects/_test")
    end

    DatabaseCleaner.clean
  end

  def test_capistrano_execute_success
    @project.setup
    @deploy.actions = ['pass_test'].to_yaml
    assert @deployer.execute?(@deploy, {})
    assert @deploy.log
  end

  def test_capistrano_execute_failed
    @project.setup
    @deploy.actions = ['fail_test'].to_yaml
    assert !@deployer.execute?(@deploy, {})
    assert @deploy.log
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deep_thought-capistrano_2-0.1.0 test/deep_thought_capistrano_test.rb