Skip to content

Commit a49b45b

Browse files
Improve coverage
1 parent c44266f commit a49b45b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/functional/time_tracker_controller_test.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def setup
103103
end
104104

105105
test '#update - with end time' do
106-
assert_equal 0, TimerSession.count
107106
FactoryBot.create(:timer_session, user: User.find(1), finished: false)
108107

109108
recorded_time = Time.zone.now - 1.hour
@@ -152,6 +151,20 @@ def setup
152151
assert_response 422
153152
end
154153

154+
test '#create - with invalid issue connection' do
155+
assert_equal 0, TimerSession.count
156+
invalid_issue_id = 999
157+
158+
post :create, params: { timer_session: {
159+
timer_start: Time.zone.now,
160+
timer_end: Time.zone.now + 1.hours,
161+
comments: 'Worked on non-existing issue',
162+
issue_ids: [invalid_issue_id]
163+
} }, xhr: true
164+
165+
assert_response 422
166+
end
167+
155168
test '#destroy - with existing session' do
156169
FactoryBot.create(:timer_session, user: User.find(1), finished: false)
157170

0 commit comments

Comments
 (0)