Sha256: 2772f233df5cbd6532554951b346d6f3c186be02207078962d889ee9c6cf87a3

Contents?: true

Size: 1.15 KB

Versions: 10

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true
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.39.0 test/unit/rollback_commands_test.rb
shipit-engine-0.38.0 test/unit/rollback_commands_test.rb
shipit-engine-0.37.0 test/unit/rollback_commands_test.rb
shipit-engine-0.36.1 test/unit/rollback_commands_test.rb
shipit-engine-0.36.0 test/unit/rollback_commands_test.rb
shipit-engine-0.35.1 test/unit/rollback_commands_test.rb
shipit-engine-0.35.0 test/unit/rollback_commands_test.rb
shipit-engine-0.34.0 test/unit/rollback_commands_test.rb
shipit-engine-0.33.0 test/unit/rollback_commands_test.rb
shipit-engine-0.32.0 test/unit/rollback_commands_test.rb