Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ def finished_at_range_params
end

def parse_with_time_zone(date)
DateTime.parse(date).in_time_zone if date.present?
Time.zone.parse(date) if date.present?
end
end
40 changes: 22 additions & 18 deletions test/controllers/jobs_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,28 @@ class MissionControl::Jobs::JobsControllerTest < ActionDispatch::IntegrationTest
end

test "get finished jobs filtered by finished_at date" do
job = DummyJob.perform_later(42)
perform_enqueued_jobs_async

get mission_control_jobs.application_jobs_url(@application, :finished)
assert_response :ok
assert_select "tr.job", 1

get mission_control_jobs.application_jobs_url(@application, :finished, filter: { finished_at_start: 1.hour.from_now.to_s })
assert_response :ok
assert_select "tr.job", 0

get mission_control_jobs.application_jobs_url(@application, :finished, filter: { finished_at_start: 1.hour.ago.to_s, finished_at_end: 1.hour.from_now })
assert_response :ok
assert_select "tr.job", 1

get mission_control_jobs.application_jobs_url(@application, :finished, filter: { finished_at_end: 1.hour.from_now })
assert_response :ok
assert_select "tr.job", 1
[ "UTC", "International Date Line West" ].each do |timezone|
Time.use_zone(timezone) do
job = DummyJob.perform_later(42)
perform_enqueued_jobs_async

get mission_control_jobs.application_jobs_url(@application, :finished)
assert_response :ok
assert_select "tr.job", 1

get mission_control_jobs.application_jobs_url(@application, :finished, filter: { finished_at_start: 1.hour.from_now.strftime("%Y-%m-%dT%H:%M") })
assert_response :ok
assert_select "tr.job", 0

get mission_control_jobs.application_jobs_url(@application, :finished, filter: { finished_at_start: 1.hour.ago.strftime("%Y-%m-%dT%H:%M"), finished_at_end: 1.hour.from_now.strftime("%Y-%m-%dT%H:%M") })
assert_response :ok
assert_select "tr.job", 1

get mission_control_jobs.application_jobs_url(@application, :finished, filter: { finished_at_end: 1.hour.from_now.strftime("%Y-%m-%dT%H:%M") })
assert_response :ok
assert_select "tr.job", 1
end
end
end

test "redirect to queue when job doesn't exist" do
Expand Down