Skip to content

Fixed AJ job name in generated error message #1814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rspec/rails/matchers/active_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def base_job_message(job)
msg_parts << "on queue #{job[:queue]}" if job[:queue]
msg_parts << "at #{Time.at(job[:at])}" if job[:at]

"#{job[:job].class.name} job".tap do |msg|
"#{job[:job].name} job".tap do |msg|
msg << " #{msg_parts.join(', ')}" if msg_parts.any?
end
end
Expand Down
5 changes: 4 additions & 1 deletion spec/rspec/rails/matchers/active_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,22 @@ def to_global_id(options = {})
let(:heavy_lifting_job) do
Class.new(ActiveJob::Base) do
def perform; end
def self.name; "HeavyLiftingJob"; end
end
end

let(:hello_job) do
Class.new(ActiveJob::Base) do
def perform(*)
end
def self.name; "HelloJob"; end
end
end

let(:logging_job) do
Class.new(ActiveJob::Base) do
def perform; end
def self.name; "LoggingJob"; end
end
end

Expand Down Expand Up @@ -217,7 +220,7 @@ def perform; end
date = Date.tomorrow.noon
message = "expected to enqueue exactly 2 jobs, with [42], on queue low, at #{date}, but enqueued 0" + \
"\nQueued jobs:" + \
"\n Class job with [1], on queue default"
"\n HelloJob job with [1], on queue default"

expect {
expect {
Expand Down