Skip to content

Instantly share code, notes, and snippets.

@kjlape
Created October 5, 2016 18:56
Show Gist options
  • Select an option

  • Save kjlape/4ecc72bbbb677c27023b392b65567986 to your computer and use it in GitHub Desktop.

Select an option

Save kjlape/4ecc72bbbb677c27023b392b65567986 to your computer and use it in GitHub Desktop.
How to use fancy rspec matchers for ActiveJob args.
require 'spec_helper.rb'
describe JobEnqueuer do
it 'enqueues the jobs' do
# Use matchers like 'a_value' in your enqueued assertions.
assert_enqueued_with(job: UsefulJob, args: [resource, data, { option: a_value }]) do
subject
end
end
end
# ...
ActiveJob::Arguments::TYPE_WHITELIST << RSpec::Matchers::AliasedMatcherWithOperatorSupport
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment