Sha256: 91bde4788b9a3f5395eb96b7d919eff6ac759830a59a497af3d75bc32b243240

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

require "helper"

if defined? ActiveJob # Rails 4.2 and later.
  class TestActiveJobAssertions < ActiveJob::TestCase
    def test_assert_enqueued_jobs
      assert_enqueued_jobs 0
      UserInviteJob.logger.silence { UserInviteJob.perform_later }
      assert_enqueued_jobs 1
    end

    def test_assert_no_enqueued_jobs
      assert_no_enqueued_jobs
      UserInviteJob.new
      assert_no_enqueued_jobs
    end

    def test_assert_performed_jobs
      assert_performed_jobs 0
      assert_performed_jobs 2 do
        UserInviteJob.logger.silence do
          UserInviteJob.perform_later
          UserInviteJob.perform_later
        end
      end
    end

    def test_assert_no_performed_jobs
      assert_no_performed_jobs
      assert_no_performed_jobs do
        UserInviteJob.new
      end
    end

    def test_assert_enqueued_with
      assert_enqueued_with job: UserInviteJob, args: [209] do
        UserInviteJob.logger.silence { UserInviteJob.perform_later(209) }
      end
    end

    def test_assert_performed_with
      assert_performed_with job: UserInviteJob, args: [107] do
        UserInviteJob.logger.silence { UserInviteJob.perform_later(107) }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
minitest-rails-3.0.0 test/rails/active_job/test_assertions.rb
minitest-rails-3.0.0.rc1 test/rails/active_job/test_assertions.rb
minitest-rails-2.2.1 test/rails/active_job/test_assertions.rb
minitest-rails-2.2.0 test/rails/active_job/test_assertions.rb