Sha256: dd1c1e0c22a0ddcd5466da8d8910fe7f4e5db480e0c9676d65ff5ec7b67bf9d6

Contents?: true

Size: 997 Bytes

Versions: 46

Compression:

Stored size: 997 Bytes

Contents

require 'test_helper'

module Shipit
  class ChunkRollupJobTest < ActiveSupport::TestCase
    setup do
      @task = shipit_tasks(:shipit)
      @job = ChunkRollupJob.new
    end

    test "#perform combines all the chunks into a output and sets rolled_up to true" do
      expected_output = @task.chunk_output
      assert @task.output.blank?

      @job.perform(@task)

      @task.reload
      assert_equal 0, @task.chunks.count
      assert @task.output.present?
      assert_equal expected_output, @task.chunk_output
      assert @task.rolled_up
    end

    test "#peform ignores non-finished jobs" do
      logger = mock
      logger.expects(:error).once
      @job.stubs(logger: logger)

      @task.update_attribute(:status, :pending)

      @job.perform(@task)
    end

    test "#perform ignores tasks already rolled up" do
      logger = mock
      logger.expects(:error).once
      @job.stubs(logger: logger)

      @task.rolled_up = true

      @job.perform(@task)
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
shipit-engine-0.31.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.30.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.29.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.28.1 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.28.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.27.1 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.27.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.26.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.25.1 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.25.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.24.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.23.1 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.23.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.22.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.21.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.20.1 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.20.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.19.0 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.18.1 test/jobs/chunk_rollup_job_test.rb
shipit-engine-0.18.0 test/jobs/chunk_rollup_job_test.rb