|
3 | 3 | class MissionControl::Jobs::JobsControllerTest < ActionDispatch::IntegrationTest |
4 | 4 | setup do |
5 | 5 | DummyJob.queue_as :queue_1 |
| 6 | + DummyReloadedJob.queue_as :queue_2 |
6 | 7 | end |
7 | 8 |
|
8 | 9 | test "get job details" do |
@@ -135,4 +136,38 @@ class MissionControl::Jobs::JobsControllerTest < ActionDispatch::IntegrationTest |
135 | 136 | ensure |
136 | 137 | I18n.available_locales = previous_locales |
137 | 138 | end |
| 139 | + |
| 140 | + test "empty string after stripping whitespace does not filter" do |
| 141 | + DummyJob.perform_later(42) |
| 142 | + DummyReloadedJob.perform_later(42) |
| 143 | + perform_enqueued_jobs_async |
| 144 | + |
| 145 | + get mission_control_jobs.application_jobs_url(@application, :finished, filter: { job_class_name: " \n\t \n\t" }) |
| 146 | + assert_response :ok |
| 147 | + assert_select "tr.job", 2 |
| 148 | + assert_select "tr.job", /DummyJob/ |
| 149 | + assert_select "tr.job", /DummyReloadedJob/ |
| 150 | + end |
| 151 | + |
| 152 | + test "get jobs filtered by class name ignoring surrounding white spaces, newlines and tabs" do |
| 153 | + DummyJob.perform_later(42) |
| 154 | + DummyReloadedJob.perform_later(42) |
| 155 | + perform_enqueued_jobs_async |
| 156 | + |
| 157 | + get mission_control_jobs.application_jobs_url(@application, :finished, filter: { job_class_name: " \n\tDummyJob \n\t" }) |
| 158 | + assert_response :ok |
| 159 | + assert_select "tr.job", 1 |
| 160 | + assert_select "tr.job", /DummyJob/ |
| 161 | + end |
| 162 | + |
| 163 | + test "get jobs filtered by queue name ignoring surrounding white spaces, newlines and tabs" do |
| 164 | + DummyJob.perform_later(42) |
| 165 | + DummyReloadedJob.perform_later(42) |
| 166 | + perform_enqueued_jobs_async |
| 167 | + |
| 168 | + get mission_control_jobs.application_jobs_url(@application, :finished, filter: { queue_name: " \n\tqueue_1 \n\t" }) |
| 169 | + assert_response :ok |
| 170 | + assert_select "tr.job", 1 |
| 171 | + assert_select "tr.job", /DummyJob/ |
| 172 | + end |
138 | 173 | end |
0 commit comments