Sha256: d9fbccc8ba1da02da7759d7a85a2522b322241e31dd335c2649eaa2e2ae27a90

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

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(:deploying?).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(:deploying?).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(:deploying?).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

6 entries across 6 versions & 1 rubygems

Version Path
shipit-engine-0.7.0 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.6.4 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.6.3 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.6.2 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.6.1 test/jobs/fetch_deployed_revision_job_test.rb
shipit-engine-0.6.0 test/jobs/fetch_deployed_revision_job_test.rb