Commit Graph

173 Commits

Author SHA1 Message Date
Jeroen van Baarsen
929a794a31 Add explicit base class for ActiveJob jobs
* Jobs generated now inherent from ApplicationJob
* ApplicationJob inherents from ActiveJob::Base
* Added entry to changelog

Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-03-23 22:37:11 +01:00
Tamir Duberstein
9832e17c3c QueueAdapters does the lookup 2015-03-12 21:55:19 -07:00
Tamir Duberstein
7e36841981 Use a more conservative const_get over constantize 2015-03-12 08:40:41 -07:00
Tamir Duberstein
1f8558fa27 ActiveJob::Base#queue_adapter is now a class_attribute
This allows different `queue_adapters` to be used in each `ActiveJob`
class heirarchy. Previously, all subclasses used a single global queue
adapter.
2015-03-11 22:45:59 -07:00
Tamir Duberstein
fb26645c1e ActiveJob::QueueAdapters::* are no longer singletons 2015-03-11 15:58:41 -07:00
Tamir Duberstein
c696cffcf6 Fix naming collision 2015-03-11 15:40:48 -07:00
Peter Suschlik
f0768eba28 Target Ruby 2.2.1 in gemspecs
This is a follow-up to #19257
2015-03-09 09:56:26 +01:00
Jeremy Kemper
a3e490419a Fix leaky only: … option for Active Job assertions
The filter was set on the pseudo-global TestAdapter but not restored to
its original value.

See e818f65770fe115ab1cc7fbacc0e7e94d92af6a4
2015-03-06 10:42:49 -07:00
Cristian Bica
cb786219f4 Fixed ActiveJob integration tests 2015-03-05 23:57:57 +02:00
Darío Hereñú
4826ec9039 Minor fixes (proposal) 2015-02-28 22:19:23 -03:00
Carlos Antonio da Silva
8adfd4fea7 Avoid creating an extra hash on the job test adapter 2015-02-24 07:23:05 -03:00
Tamir Duberstein
802f855ecf ActiveJob::QueueAdapters::TestAdapter is now a singleton
Since `ActiveJob::TestHelper` globally sets
`ActiveJob::Base.queue_adapter` on setup, there is no benefit in
instantiating a new `TestAdapter` per tests. The original rationale was
to allow parallel tests to run without interference, but since they'd
all mutate the global `ActiveJob::Base.queue_adapter`, that was never
realized.
2015-02-23 17:31:36 -08:00
Jeroen van Baarsen
e380ac685b Changed the AJADAPTER to AJ_ADAPTER
* This allows for easier reading, since those are two words, so they should be
  split by _

Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-02-22 16:11:21 +01:00
Carlos Antonio da Silva
de9a3748c4 Move #18833 changelog to the top [ci skip] 2015-02-08 11:52:47 -02:00
Michael Ryan
e818f65770 Add an :only option to perform_enqueued_jobs to filter jobs based on
type.

This allows specific jobs to be tested, while preventing others from
being performed unnecessarily.

Example:

    def test_hello_job
      assert_performed_jobs 1, only: HelloJob do
        HelloJob.perform_later('jeremy')
        LoggingJob.perform_later
      end
    end

An array may also be specified, to support testing multiple jobs.

Example:

    def test_hello_and_logging_jobs
      assert_nothing_raised do
        assert_performed_jobs 2, only: [HelloJob, LoggingJob] do
          HelloJob.perform_later('jeremy')
          LoggingJob.perform_later('stewie')
          RescueJob.perform_later('david')
        end
      end
    end

Fixes #18802.

Trim space and document :only option.
2015-02-06 14:11:42 -05:00
robertomiranda
ce8efcf296 Use public Module#include, in favor of https://bugs.ruby-lang.org/issues/8846
ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
2015-01-31 23:12:41 -05:00
Sean Griffin
31085a5cd4 Allow keyword arguments to work with ActiveJob
Unfortunately, the HashWithIndifferent access approach is insufficient
for our needs. It's perfectly reasonable to want to use keyword
arguments with Active Job, which we will see as a symbol keyed hash. For
Ruby to convert this back to keyword arguments, it must deserialize to a
symbol keyed hash.

There are two primary changes to the serialization behavior. We first
treat a HWIA separately, and mark it as such so we can convert it back
into a HWIA during deserialization.

For normal hashes, we keep a list of all symbol keys, and convert them
back to symbol keys after deserialization.

Fixes #18741.
2015-01-30 13:43:39 -07:00
Richard Manyanza
9d3042d05e Fix ActiveJob assertions with a GlobalID object argument 2015-01-23 17:46:16 +03:00
Yves Senn
a7621d7d53 formatting pass over CHANGELOGs. [ci skip] 2015-01-10 12:17:57 +01:00
George Claghorn
91e31e82fe Add :only option to assert_no_enqueued_jobs 2015-01-08 09:39:01 -05:00
Carlos Antonio da Silva
a22a653c29 Fix Active Job changelog formatting and reword a bit [ci skip] 2015-01-08 07:40:00 -02:00
George Claghorn
b5e88317cc Add :only option to assert_enqueued_jobs
With the option, assert_enqueued_jobs will check the number of times a specific kind of job is enqueued.
2015-01-07 23:44:08 -05:00
Rafael Mendonça França
4ab0320fb4 No need to disable sidikiq tests with 1.9.3 anymore 2015-01-04 15:54:22 -03:00
Rafael Mendonça França
8a1c3476a6 Do not run integration tests for the test adapter 2015-01-02 00:09:10 -03:00
Robin Dupret
24637e577c Merge pull request #18271 from arunagw/change-copyright-year
Update copyright notices to 2015 [ci skip]
2015-01-01 00:08:17 +01:00
Robin Dupret
f2b31cd6d1 Tiny follow-up to #18260 [ci skip]
Indent the list content by 4 spaces instead of 2 to match the other
changelog files. Also wrap the lines around 80 chars.

Finally update the documentation example with nit-picky things.
2014-12-31 17:35:41 +01:00
Arun Agrawal
c7a1f70fdd Merge pull request #18277 from prathamesh-sonpatki/typo-aj-changelog
Fixed typo in ActiveJob CHANGELOG [ci skip]
2014-12-31 17:32:44 +01:00
Prathamesh Sonpatki
c8e4d0a0a1 Fixed typo in ActiveJob CHANGELOG [ci skip] 2014-12-31 21:59:37 +05:30
Robin Dupret
7d1718f49e Merge pull request #18274 from rajcybage/spell_fix
Fix spell life cycle on activejob docs [ci skip]
2014-12-31 11:26:23 +01:00
Rajarshi Das
0f80b9f997 Fix spell life cycle on activejob docs [ ci skip] 2014-12-31 15:51:37 +05:30
Arun Agrawal
4de18d0ead Update copyright notices to 2015 [ci skip] 2014-12-31 08:34:14 +01:00
Prathamesh Sonpatki
2ecee1034d ActiveJob is not ActionJob [ci skip] 😄 2014-12-31 11:27:32 +05:30
Rafael Mendonça França
0d1ab34915 Merge pull request #18266 from cristianbica/ajfixes
ActiveJob testing improvements
2014-12-30 21:05:29 -03:00
Isaac Seymour
65542e2797 ActiveJob: delegate full deserialization to class 2014-12-30 23:33:09 +00:00
Cristian Bica
8a73f4b5b9 ActiveJob testing improvements
1. The :test adapter wasn't going through a full cycle of
serialize/deserialize when performing jobs. Now it does
2. Regular AJ tests were not run for the :test adapter. Now they are
3. ActiveJob::TestHelper uses assert_valid_keys but doesn’t requires
the file that implements that method. Now it does
2014-12-30 17:53:42 +02:00
Yukio Mizuta
8a1d1d4e14 Expectation comes first 2014-12-28 17:55:40 -08:00
claudiob
d3b098b828 Require Ruby 2.2 for Rails 5.0
Stems from [this comment](https://github.com/rails/rails/pull/18203#issuecomment-68138096) by @robin850
and by the blog post http://weblog.rubyonrails.org/2014/12/19/Rails-4-2-final
2014-12-26 13:53:09 +01:00
joker1007
7b76f05cd1 Add 'require' for Hash#with_indifferent_access
ActiveJob::Arguments uses Hash#with_indifferent_access.
But, activejob gem does not require Hash extension library.
When we use activejob as standalone,
we need extra require statement. This is unhandy.

This commit fixes it.
2014-12-21 21:03:16 +09:00
claudiob
902da271f5 Replace guides.ror.org/v4.2.0 with guides.ror.org
No need to point links to http://guides.rubyonrails.org/v4.2.0/... now
that the Ruby on Rails guides point to 4.2.0.
2014-12-20 05:37:09 -08:00
Rafael Mendonça França
aab670b430 redis 3.2.0 doesn't allow tcp protocol anymore
Use redis protocol
2014-12-13 00:06:31 -02:00
David Heinemeier Hansson
4419294eaa Include missing require 2014-12-05 15:16:10 +01:00
David Heinemeier Hansson
ad4935f127 Merge pull request #17817 from aripollak/hide-activejob-args
GlobalID objects are logged by their URI, not #inspect on the object, to prevent logging private data
2014-12-05 11:05:15 -02:00
Ari Pollak
e2fffbff98 Inline to_global_id conversion 2014-12-04 18:25:05 -05:00
Ari Pollak
e5e44ba8db Use try instead of checking for GlobalID::Identification 2014-12-04 16:51:59 -05:00
Rafael Mendonça França
191ea4b85b Merge pull request #17825 from aripollak/fix-activejob-sidekiq-integration
Fix Sidekiq ActiveJob integration setup

Conflicts:
	activejob/test/support/integration/adapters/sidekiq.rb
2014-12-04 18:24:23 -02:00
Ari Pollak
25c8ea264e Only filter GIDable objects; remove cosmetic changes 2014-12-01 11:16:30 -05:00
Erik Michaels-Ober
d1374f99bf Pass symbol as an argument instead of a block 2014-11-29 11:53:24 +01:00
claudiob
96d0f751f9 Bump required Ruby version to 2.1.0
[This article](http://weblog.rubyonrails.org/2014/8/20/Rails-4-2-beta1/#maintenance-consequences-and-rails-5-0) states that:

> Rails 5.0 is in most likelihood going to target Ruby 2.2.

Before the exact minimum version is fully decided, @arthurnn [suggests](https://github.com/rails/rails/pull/17830#issuecomment-64940383)
that **at least** version 2.1.0 **must** be required by the `gemspec` files.
2014-11-28 22:59:51 -08:00
Ari Pollak
802630378e Hide potentially sensitive ActiveJob params from logs
* Show GlobalID instead of full object .inspect output
2014-11-28 22:20:50 -05:00
Ari Pollak
2fa4cbeebd Fix Sidekiq ActiveJob integration setup
* .connect on a Redis connection wasn't valid
* Reset logger after we're done testing for redis connection to avoid
  "closed stream" error when starting server for real from a fork
2014-11-28 17:18:32 -05:00