@@ -698,10 +698,35 @@ def test_assert_enqueued_with_failure_with_global_id_args
698
698
HelloJob . perform_later ( ricardo )
699
699
end
700
700
end
701
+
701
702
assert_match ( /No enqueued job found with {:job=>HelloJob, :args=>\[ #{ wilma . inspect } \] }/ , error . message )
702
703
assert_match ( /Potential matches: {.*?:job=>HelloJob, :args=>\[ #<Person.* @id="9">\] , :queue=>"default".*?}/ , error . message )
703
704
end
704
705
706
+ def test_show_jobs_that_are_enqueued_when_job_is_not_queued_at_all
707
+ ricardo = Person . new ( 9 )
708
+ wilma = Person . new ( 11 )
709
+
710
+ error = assert_raise ActiveSupport ::TestCase ::Assertion do
711
+ assert_enqueued_with ( job : MultipleKwargsJob , args : [ wilma ] ) do
712
+ HelloJob . perform_later ( ricardo )
713
+ end
714
+ end
715
+
716
+ assert_match ( /No enqueued job found with {:job=>MultipleKwargsJob, :args=>\[ #{ wilma . inspect } \] }/ , error . message )
717
+ assert_match ( /No jobs of class MultipleKwargsJob where enqueued, job classes enqueued: HelloJob/ , error . message )
718
+ end
719
+
720
+ def test_shows_no_jobs_enqueued_when_there_are_no_jobs
721
+ error = assert_raise ActiveSupport ::TestCase ::Assertion do
722
+ assert_enqueued_with ( job : HelloJob , args : [ ] ) do
723
+ end
724
+ end
725
+
726
+ assert_match ( /No enqueued job found with {:job=>HelloJob, :args=>\[ \] }/ , error . message )
727
+ assert_match ( /No jobs where enqueued/ , error . message )
728
+ end
729
+
705
730
def test_assert_enqueued_with_failure_with_no_block_with_global_id_args
706
731
ricardo = Person . new ( 9 )
707
732
wilma = Person . new ( 11 )
@@ -1954,6 +1979,28 @@ def test_assert_performed_with_without_block_failure_with_global_id_args
1954
1979
assert_match ( /Potential matches: {.*?:job=>HelloJob, :args=>\[ #<Person.* @id="9">\] , :queue=>"default".*?}/ , error . message )
1955
1980
end
1956
1981
1982
+ def test_assert_performed_says_no_jobs_performed
1983
+ error = assert_raise ActiveSupport ::TestCase ::Assertion do
1984
+ assert_performed_with ( job : HelloJob , args : [ ] )
1985
+ end
1986
+
1987
+ assert_match ( /No performed job found with {:job=>HelloJob, :args=>\[ \] }/ , error . message )
1988
+ assert_match ( /No jobs where performed/ , error . message )
1989
+ end
1990
+
1991
+ def test_assert_performed_when_not_matching_the_class_shows_alteratives
1992
+ ricardo = Person . new ( 9 )
1993
+ wilma = Person . new ( 11 )
1994
+ HelloJob . perform_later ( ricardo )
1995
+ perform_enqueued_jobs
1996
+ error = assert_raise ActiveSupport ::TestCase ::Assertion do
1997
+ assert_performed_with ( job : MultipleKwargsJob , args : [ wilma ] )
1998
+ end
1999
+
2000
+ assert_match ( /No performed job found with {:job=>MultipleKwargsJob, :args=>\[ #<Person.* @id=11>\] }/ , error . message )
2001
+ assert_match ( /No jobs of class MultipleKwargsJob where performed, job classes performed: HelloJob/ , error . message )
2002
+ end
2003
+
1957
2004
def test_assert_performed_with_does_not_change_jobs_count
1958
2005
assert_performed_with ( job : HelloJob ) do
1959
2006
HelloJob . perform_later
0 commit comments