1. 06 10月, 2018 1 次提交
  2. 29 9月, 2018 2 次提交
    • Y
      Add `Style/RedundantFreeze` to remove redudant `.freeze` · aa3dcabd
      Yasuo Honda 提交于
      Since Rails 6.0 will support Ruby 2.4.1 or higher
      `# frozen_string_literal: true` magic comment is enough to make string object frozen.
      This magic comment is enabled by `Style/FrozenStringLiteralComment` cop.
      
      * Exclude these files not to auto correct false positive `Regexp#freeze`
       - 'actionpack/lib/action_dispatch/journey/router/utils.rb'
       - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb'
      
      It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333
      Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed.
      
      * Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required
      
       - 'actionpack/test/controller/test_case_test.rb'
       - 'activemodel/test/cases/type/string_test.rb'
       - 'activesupport/lib/active_support/core_ext/string/strip.rb'
       - 'activesupport/test/core_ext/string_ext_test.rb'
       - 'railties/test/generators/actions_test.rb'
      aa3dcabd
    • M
      Documentation clarity in ActiveJob::TestHelper [ci skip] (#33571) · 9fa43429
      Mohit Natoo 提交于
      * Documentation clarity in ActiveJob::TestHelper [ci skip]
      
      * Documentation for options
      
      [Mohit Natoo + Rafael Mendonça França]
      9fa43429
  3. 27 9月, 2018 1 次提交
    • E
      Add a way to check for subset of arguments when performing jobs: · 4d75f589
      Edouard CHIN 提交于
      - When calling `assert_performed_with`/`assert_enqueued_with`, the
        +args+ needs to match exactly what the job get passed.
      
        Some jobs can have lot of arguments, or even a simple hash argument
        has many key. This is not convenient to test as most tests doesn't
        need to check if the arguments matches perfectly.
      
        This PR make it possible to only check if a subset of arguments were
        passed to the job.
      4d75f589
  4. 24 9月, 2018 1 次提交
  5. 22 9月, 2018 1 次提交
  6. 21 9月, 2018 1 次提交
  7. 16 9月, 2018 1 次提交
  8. 14 9月, 2018 1 次提交
  9. 13 9月, 2018 1 次提交
    • R
      Include test helpers when ActionDispatch::IntegrationTest is loaded · 64a9759a
      Ricardo Díaz 提交于
      As @dhh brings up, the point of `ActionDispatch::IntegrationTest` is to
      allow users to test the integration of all the pieces called by a
      controller. Asserting about the emails and jobs queued is part of that
      task.
      
      This commit includes the `ActionMailer::TestHelper` and
      `ActiveJob::TestHelper` modules when the ActionMailer and ActiveJob
      railties are initialized respectively.
      64a9759a
  10. 09 9月, 2018 1 次提交
  11. 08 9月, 2018 1 次提交
  12. 31 8月, 2018 1 次提交
  13. 30 8月, 2018 1 次提交
  14. 27 8月, 2018 1 次提交
  15. 25 8月, 2018 1 次提交
  16. 20 8月, 2018 8 次提交
    • B
      DRY in `assert_enqueued_jobs` · b8576425
      bogdanvlviv 提交于
      b8576425
    • B
      Fix formatting of `ActiveJob::TestHelper` api docs · b7beb5d4
      bogdanvlviv 提交于
      b7beb5d4
    • B
      Allow `assert_performed_with` to be called without a block. · 2ec60fb8
      bogdanvlviv 提交于
      Example:
      ```
      def test_assert_performed_with
        MyJob.perform_later(1,2,3)
      
        perform_enqueued_jobs
      
        assert_performed_with(job: MyJob, args: [1,2,3], queue: 'high')
      end
      ```
      
      Follow up #33626.
      2ec60fb8
    • B
      Fix `assert_performed_jobs` and `assert_no_performed_jobs` · 11634e8e
      bogdanvlviv 提交于
      Execution of `assert_performed_jobs`, and `assert_no_performed_jobs`
      without a block should respect passed `:except`, `:only`, and `:queue` options.
      11634e8e
    • B
      Allow `:queue` option to `assert_no_performed_jobs`. · de4420da
      bogdanvlviv 提交于
      If the `:queue` option is specified, then only the job(s) enqueued to a specific
      queue will not be performed.
      
      Example:
      ```
      def test_assert_no_performed_jobs_with_queue_option
        assert_no_performed_jobs queue: :some_queue do
          HelloJob.set(queue: :other_queue).perform_later("jeremy")
        end
      end
      ```
      de4420da
    • B
      Allow `:queue` option to `assert_performed_jobs`. · d50fb21e
      bogdanvlviv 提交于
      If the `:queue` option is specified, then only the job(s) enqueued to a specific
      queue will be performed.
      
      Example:
      ```
      def test_assert_performed_jobs_with_queue_option
        assert_performed_jobs 1, queue: :some_queue do
          HelloJob.set(queue: :some_queue).perform_later("jeremy")
          HelloJob.set(queue: :other_queue).perform_later("bogdan")
        end
      end
      ```
      d50fb21e
    • B
      Fix `perform_enqueued_jobs` · e0cf042f
      bogdanvlviv 提交于
      Set
      ````
      queue_adapter.perform_enqueued_jobs = true
      queue_adapter.perform_enqueued_at_jobs = true
      queue_adapter.filter = only
      queue_adapter.reject = except
      queue_adapter.queue = queue
      ```
      if block given.
      Execution of `flush_enqueued_jobs` doesn't require that.
      e0cf042f
    • B
      Allow `:queue` option to `perform_enqueued_jobs`. · ec2e8f64
      bogdanvlviv 提交于
      If the `:queue` option is specified, then only the job(s) enqueued to
      a specific queue will be performed.
      
      Example:
      ```
      def test_perform_enqueued_jobs_with_queue
        perform_enqueued_jobs queue: :some_queue do
          MyJob.set(queue: :some_queue).perform_later(1, 2, 3) # will be performed
          HelloJob.set(queue: :other_queue).perform_later(1, 2, 3) # will not be performed
        end
        assert_performed_jobs 1
      end
      ```
      
      Follow up #33265
      
      [bogdanvlviv & Jeremy Daer]
      ec2e8f64
  17. 18 8月, 2018 1 次提交
    • Y
      Increment execution count before deserialize arguments · e49fb792
      yuuji.yaginuma 提交于
      Currently, the execution count increments after deserializes arguments.
      Therefore, if an error occurs with deserialize, it retries indefinitely.
      
      In order to prevent this, the count is moved before deserialize.
      Fixes #33344.
      e49fb792
  18. 16 8月, 2018 2 次提交
  19. 10 8月, 2018 1 次提交
  20. 09 8月, 2018 1 次提交
  21. 24 7月, 2018 1 次提交
  22. 21 7月, 2018 1 次提交
  23. 18 7月, 2018 1 次提交
  24. 03 7月, 2018 1 次提交
  25. 01 7月, 2018 1 次提交
  26. 30 6月, 2018 2 次提交
    • B
      Allow `queue` option to `assert_no_enqueued_jobs` · 22c7d565
      bogdanvlviv 提交于
      It can be asserted that no jobs are enqueued to a specific queue:
      ```ruby
      def test_no_logging
        assert_no_enqueued_jobs queue: 'default' do
          LoggingJob.set(queue: :some_queue).perform_later
        end
      end
      ```
      22c7d565
    • B
      Clarify activejob/lib/active_job/test_helper.rb · 58271f63
      bogdanvlviv 提交于
      Rename `in_block_job` to `enqueued_job` since this variable can refer not only
      to jobs that were created in the block.
      See #33258.
      
      Return back accidentally removed test to activejob/test/cases/test_helper_test.rb
      See #33258.
      
      Fix name of tests.
      58271f63
  27. 29 6月, 2018 1 次提交
    • B
      Allow call `assert_enqueued_with` and `assert_enqueued_email_with` with no block · 4382fcbc
      bogdanvlviv 提交于
      Example of `assert_enqueued_with` with no block
      ```ruby
      def test_assert_enqueued_with
        MyJob.perform_later(1,2,3)
        assert_enqueued_with(job: MyJob, args: [1,2,3], queue: 'low')
      
        MyJob.set(wait_until: Date.tomorrow.noon).perform_later
        assert_enqueued_with(job: MyJob, at: Date.tomorrow.noon)
      end
      ```
      
      Example of `assert_enqueued_email_with` with no block:
      ```ruby
      def test_email
        ContactMailer.welcome.deliver_later
        assert_enqueued_email_with ContactMailer, :welcome
      end
      
      def test_email_with_arguments
        ContactMailer.welcome("Hello", "Goodbye").deliver_later
        assert_enqueued_email_with ContactMailer, :welcome, args: ["Hello", "Goodbye"]
      end
      ```
      
      Related to #33243
      4382fcbc
  28. 28 6月, 2018 2 次提交
  29. 27 6月, 2018 1 次提交