Created
July 17, 2016 10:50
-
-
Save jameslafa/c59717c2039c237d5dea95c81605d9b5 to your computer and use it in GitHub Desktop.
Expect Job being enqueued with args
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.describe MyController, type: :controller do | |
include ActiveJob::TestHelper | |
describe "..." do | |
it "enqueues the job with the right arguments" do | |
expect { | |
@bookmark = post :create, {:bookmark => valid_attributes} | |
}.to have_enqueued_job(SlackNotifierJob).with { |args| | |
expect(args).to eq(["new_bookmark", @bookmark]) | |
} | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Add in config/environments/test.rb | |
# Enable: ActiveJob::Base.queue_adapter.enqueued_jobs | |
config.active_job.queue_adapter = :test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment