Sha256: 494593c21b4a0e515f87ac1f528f135e8c651936465ade6269c2d811a444a516

Contents?: true

Size: 1.08 KB

Versions: 10

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true
require 'test_helper'

module Shipit
  class FetchDeployedRevisionJobTest < ActiveSupport::TestCase
    setup do
      @stack = shipit_stacks(:shipit)
      @job = FetchDeployedRevisionJob.new
      @commit = shipit_commits(:fifth)
    end

    test 'the job abort if the stack is deploying' do
      @stack.expects(:active_task?).returns(true)
      assert_no_difference 'Deploy.count' do
        @job.perform(@stack)
      end
    end

    test 'the job abort if #fetch_deployed_revision returns nil' do
      @stack.expects(:active_task?).returns(false)
      StackCommands.any_instance.expects(:fetch_deployed_revision).returns(nil)
      @stack.expects(:update_deployed_revision).never
      @job.perform(@stack)
    end

    test 'the job call update_deployed_revision if #fetch_deployed_revision returns something' do
      @stack.expects(:active_task?).returns(false)
      StackCommands.any_instance.expects(:fetch_deployed_revision).returns(@commit.sha)
      @stack.expects(:update_deployed_revision).with(@commit.sha)
      @job.perform(@stack)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shipit-engine-0.39.0 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.38.0 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.37.0 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.36.1 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.36.0 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.35.1 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.35.0 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.34.0 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.33.0 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.32.0 test/jobs/fetch_deployed_revision_job_test.rb