Created
October 5, 2016 18:56
-
-
Save kjlape/4ecc72bbbb677c27023b392b65567986 to your computer and use it in GitHub Desktop.
How to use fancy rspec matchers for ActiveJob args.
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| # ... | |
| 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