Sha256: fb381ec4adf8e707b4bf8dbc17b609cd08ab9d035e427fad4a28188460f449cf

Contents?: true

Size: 920 Bytes

Versions: 3

Compression:

Stored size: 920 Bytes

Contents

require 'test_helper'

module Shipit
  class AppendDelayedReleaseStatusJobTest < ActiveSupport::TestCase
    setup do
      @job = AppendDelayedReleaseStatusJob.new
      @deploy = shipit_deploys(:shipit_complete)
    end

    test "#perform bails out if another status was appended in the meantime" do
      cursor = @deploy.last_release_status
      @deploy.append_release_status(cursor.state, 'Something else happened')
      assert_no_difference -> { ReleaseStatus.count } do
        @job.perform(@deploy, cursor: cursor, status: 'success', description: 'Nothing happened')
      end
    end

    test "#perform appends the new status if no other status was appended in the meantime" do
      cursor = @deploy.last_release_status
      assert_difference -> { ReleaseStatus.count }, +1 do
        @job.perform(@deploy, cursor: cursor, status: 'success', description: 'Something happened')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shipit-engine-0.26.0 test/jobs/append_delayed_release_status_job_test.rb
shipit-engine-0.25.1 test/jobs/append_delayed_release_status_job_test.rb
shipit-engine-0.25.0 test/jobs/append_delayed_release_status_job_test.rb