Sha256: e5dbae98334856944adc9dffd2e98f410adb46b9306f227b0b302e8c5831f6f4

Contents?: true

Size: 1.11 KB

Versions: 10

Compression:

Stored size: 1.11 KB

Contents

require 'test_helper'

module Shipit
  class RollbackCommandsTest < ActiveSupport::TestCase
    def setup
      @stack = shipit_stacks(:shipit)
      @rollback = shipit_rollbacks(:shipit_rollback)
      @commands = RollbackCommands.new(@rollback)
      @deploy_spec = stub(
        dependencies_steps!: ['bundle install --some-args'],
        deploy_steps!: ['bundle exec cap $ENVIRONMENT deploy'],
        rollback_steps!: ['bundle exec cap $ENVIRONMENT deploy:rollback'],
        machine_env: {'GLOBAL' => '1'},
        directory: nil,
        clear_working_directory?: true,
      )
      @commands.stubs(:deploy_spec).returns(@deploy_spec)

      StackCommands.stubs(git_version: Gem::Version.new('1.8.4.3'))
    end

    test "#perform calls cap $environment deploy" do
      commands = @commands.perform
      assert_equal 1, commands.length
      command = commands.first
      assert_equal ['bundle exec cap $ENVIRONMENT deploy:rollback'], command.args
    end

    test "#perform sets ROLLBACK=1" do
      commands = @commands.perform
      command = commands.first
      assert_equal '1', command.env['ROLLBACK']
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shipit-engine-0.31.0 test/unit/rollback_commands_test.rb
shipit-engine-0.30.0 test/unit/rollback_commands_test.rb
shipit-engine-0.29.0 test/unit/rollback_commands_test.rb
shipit-engine-0.28.1 test/unit/rollback_commands_test.rb
shipit-engine-0.28.0 test/unit/rollback_commands_test.rb
shipit-engine-0.27.1 test/unit/rollback_commands_test.rb
shipit-engine-0.27.0 test/unit/rollback_commands_test.rb
shipit-engine-0.26.0 test/unit/rollback_commands_test.rb
shipit-engine-0.25.1 test/unit/rollback_commands_test.rb
shipit-engine-0.25.0 test/unit/rollback_commands_test.rb