lib/resque_spec/matchers.rb in resque_spec-0.9.2 vs lib/resque_spec/matchers.rb in resque_spec-0.9.3
- old
+ new
@@ -26,11 +26,11 @@
RSpec::Matchers.define :have_queued do |*expected_args|
extend InQueueHelper
match do |actual|
- queue(actual).any? { |entry| entry[:class].to_s == actual.to_s && entry[:args] == expected_args }
+ queue(actual).any? { |entry| entry[:class].to_s == actual.to_s && expected_args == entry[:args] }
end
failure_message_for_should do |actual|
"expected that #{actual} would have [#{expected_args.join(', ')}] queued"
end
@@ -78,11 +78,11 @@
end
match do |actual|
ResqueSpec.schedule_for(actual).any? do |entry|
class_matches = entry[:class].to_s == actual.to_s
- args_match = entry[:args] == expected_args
+ args_match = expected_args == entry[:args]
time_matches = if @time
entry[:time] == @time
elsif @interval
entry[:time].to_i == entry[:stored_at].to_i + @interval
@@ -111,10 +111,10 @@
warn "DEPRECATION WARNING: have_scheduled_at(time, *args) is deprecated and will be removed in future. Please use have_scheduled(*args).at(time) instead."
match do |actual|
time = expected_args.first
other_args = expected_args[1..-1]
- ResqueSpec.schedule_for(actual).any? { |entry| entry[:class].to_s == actual.to_s && entry[:time] == time && entry[:args] == other_args }
+ ResqueSpec.schedule_for(actual).any? { |entry| entry[:class].to_s == actual.to_s && entry[:time] == time && other_args == entry[:args] }
end
failure_message_for_should do |actual|
"expected that #{actual} would have [#{expected_args.join(', ')}] scheduled"
end