Sha256: b4584085ca8a93c0f53c01908d93cb0f2c228ac62b93770b1a1be0ca2df99101

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 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?).returns(true)
    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

2 entries across 2 versions & 1 rubygems

Version Path
deep_thought-0.2.1 test/deep_thought_shell_test.rb
deep_thought-0.1.1 test/deep_thought_shell_test.rb