wspurgin / rspec-sidekiq

RSpec for Sidekiq
https://github.com/wspurgin/rspec-sidekiq
Other
663 stars 132 forks source link

Add support for matching argument #154

Closed tomoyuki-yanagisawa closed 1 year ago

tomoyuki-yanagisawa commented 6 years ago

(Please consider adding support for matching argument) To allow not only the exact argument but also its regular expressions or any non-nil arguments to pass. Thanks for your support and help.

See also: https://relishapp.com/rspec/rspec-mocks/v/3-1/docs/setting-constraints/matching-arguments

Examples:

# old
SlackApi.sidekiq_delay.post_to('message')

expect(SlackApi.method :post_to).to be_delayed('message') #=> OK
expect(SlackApi.method :post_to).to be_delayed #=> NG
expect(SlackApi.method :post_to).to be_delayed(/^message/) #=> NG
expect(SlackApi.method :post_to).to be_delayed(any_args) #=> NG

# new
SlackApi.sidekiq_delay.post_to('message')

expect(SlackApi.method :post_to).to be_delayed('message') #=> OK
expect(SlackApi.method :post_to).to be_delayed #=> NG
expect(SlackApi.method :post_to).to be_delayed(/^message/) #=> OK
expect(SlackApi.method :post_to).to be_delayed(any_args) #=> OK
coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.8%) to 97.79% when pulling ab42fa43016173356e876688781dabdcaf70087a on coincheckjp:support-matching-arguments into 12135312a7868353a51586bf97489dd2c3f0846d on philostler:develop.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.8%) to 97.79% when pulling ab42fa43016173356e876688781dabdcaf70087a on coincheckjp:support-matching-arguments into 12135312a7868353a51586bf97489dd2c3f0846d on philostler:develop.