File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
spec/rspec/rails/matchers Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,34 @@ def self.name; "LoggingJob"; end
106
106
} . to raise_error ( /expected to enqueue exactly 1 jobs, but enqueued 2/ )
107
107
end
108
108
109
+
110
+ it "shows correct fail message when negated with at_least matcher" do
111
+ expect {
112
+ expect {
113
+ heavy_lifting_job . perform_later
114
+ heavy_lifting_job . perform_later
115
+ } . not_to have_enqueued_job . at_least ( 2 )
116
+ } . to raise_error ( /expected not to enqueue at least 2 jobs, but enqueued 2/ )
117
+ end
118
+
119
+ it "shows correct fail message when negated with at_most matcher" do
120
+ expect {
121
+ expect {
122
+ heavy_lifting_job . perform_later
123
+ heavy_lifting_job . perform_later
124
+ } . not_to have_enqueued_job . at_most ( 2 )
125
+ } . to raise_error ( /expected not to enqueue at most 2 jobs, but enqueued 2/ )
126
+ end
127
+
128
+ it "fails when too many jobs enqueued in negated form" do
129
+ expect {
130
+ expect {
131
+ heavy_lifting_job . perform_later
132
+ heavy_lifting_job . perform_later
133
+ } . not_to have_enqueued_job . exactly ( 2 )
134
+ } . to raise_error ( /expected not to enqueue exactly 2 jobs, but enqueued 2/ )
135
+ end
136
+
109
137
it "reports correct number in fail error message" do
110
138
heavy_lifting_job . perform_later
111
139
expect {
You can’t perform that action at this time.
0 commit comments