Sha256: 8f6d90eed6db7d863f4ad8fd53a7f3e791583e942cb586ad315fb8352c346267

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

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

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

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

    deployer = mock('class')
    deployer.stubs(:new).returns(deployer)
    deployer.stubs(:setup)
    DeepThought::Deployer.register_adapter('mock', deployer)

    @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::Shell.new
  end

  def teardown
    FileUtils.rm_rf "./.projects/_test"

    DatabaseCleaner.clean
  end

  def test_shell_execute_success
    @project.setup
    assert @deployer.execute(@deploy, {})
    assert @deploy.log
  end

  def test_shell_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-0.1.0 test/deep_thought_shell_test.rb