Skip to content

Commit

Permalink
Merge pull request wspurgin#30 from johanneswuerbach/general-matchers
Browse files Browse the repository at this point in the history
Allow use of rspec general matchers
  • Loading branch information
philostler committed Dec 16, 2013
2 parents 18f7d1c + fec75c0 commit d99953b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.md
@@ -1,3 +1,7 @@
Master
---
* Allow to use [general matchers](https://www.relishapp.com/rspec/rspec-mocks/v/2-14/docs/argument-matchers/general-matchers) in have_enqueued_job [johanneswuerbach#30]

1.0.0
---
* Add delay extension matchers [sosaucily#22]
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/sidekiq/matchers/have_enqueued_job.rb
Expand Up @@ -22,7 +22,7 @@ def failure_message
def matches? klass
@klass = klass
@actual = klass.jobs.map { |job| job["args"] }
@actual.include? @expected
@actual.any? { |args| Array(@expected) == args }
end

def negative_failure_message
Expand Down
16 changes: 16 additions & 0 deletions spec/rspec/sidekiq/matchers/have_enqueued_job_spec.rb
@@ -0,0 +1,16 @@
require "spec_helper"

describe "Have Enqueued Job matcher" do
describe "expect syntax" do
before do
TestWorker.perform_async('5')
end
it "correctly matches" do
expect(TestWorker).to have_enqueued_job('5')
end

it "correctly matches using a general matcher" do
expect(TestWorker).to have_enqueued_job(an_instance_of(String))
end
end
end

0 comments on commit d99953b

Please sign in to comment.