Skip to content
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

Support symbol argument in #on_queue #2283

Merged
merged 2 commits into from Mar 5, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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