Skip to content

Commit

Permalink
Merge pull request #2283 from nsommer/support-symbol-queue-names-in-j…
Browse files Browse the repository at this point in the history
…ob-matcher

Support symbol argument in #on_queue
  • Loading branch information
JonRowe committed Mar 13, 2020
1 parent a0736d3 commit 6fada81
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/rspec/rails/matchers/active_job.rb
Expand Up @@ -26,7 +26,7 @@ def with(*args, &block)
end

def on_queue(queue)
@queue = queue
@queue = queue.to_s
self
end

Expand Down
16 changes: 14 additions & 2 deletions spec/rspec/rails/matchers/active_job_spec.rb
Expand Up @@ -197,12 +197,18 @@ def self.name; "LoggingJob"; end
}.to raise_error(/expected to enqueue at most 1 jobs, but enqueued 2/)
end

it "passes with provided queue name" do
it "passes with provided queue name as string" do
expect {
hello_job.set(:queue => "low").perform_later
}.to have_enqueued_job.on_queue("low")
end

it "passes with provided queue name as symbol" do
expect {
hello_job.set(:queue => "low").perform_later
}.to have_enqueued_job.on_queue(:low)
end

it "passes with provided at date" do
date = Date.tomorrow.noon
expect {
Expand Down Expand Up @@ -531,12 +537,18 @@ def self.name; "LoggingJob"; end
}.to raise_error(/expected to perform at most 1 jobs, but performed 2/)
end

it "passes with provided queue name" do
it "passes with provided queue name as string" do
expect {
hello_job.set(:queue => "low").perform_later
}.to have_performed_job.on_queue("low")
end

it "passes with provided queue name as symbol" do
expect {
hello_job.set(:queue => "low").perform_later
}.to have_performed_job.on_queue(:low)
end

it "passes with provided at date" do
date = Date.tomorrow.noon
expect {
Expand Down

0 comments on commit 6fada81

Please sign in to comment.