Skip to content

Commit

Permalink
#185 better texts
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Mar 14, 2018
1 parent 243a47c commit 03597c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 8 additions & 4 deletions objects/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,18 @@ def summary(xml, ticket)
if all.empty?
''
elsif all.length == 1
"the last puzzle #{all[0]} is solved here"
"the only puzzle #{all[0]} is solved here"
else
"all #{all.length} puzzles are solved here: #{all.join(', ')}"
end
elsif alive.length == 1
"the puzzle #{alive[0]} is still not solved"
else
"these puzzles are still not solved: #{alive.join(', ')}"
solved = all - alive
tail = solved.empty? ? '' : "; solved: #{solved.join(', ')}"
if alive.length == 1
"the puzzle #{alive[0]} is still not solved"
else
"#{alive.length} puzzles #{alive.join(', ')} are still not solved"
end + tail
end
end
end
6 changes: 3 additions & 3 deletions test/test_diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_notification_on_two_new_puzzles
)
assert(
tickets.messages[0] ==
'55 these puzzles are still not solved: [#66](#), [#77](#).',
'55 2 puzzles [#66](#), [#77](#) are still not solved.',
"Text is wrong: #{tickets.messages[0]}"
)
end
Expand All @@ -120,7 +120,7 @@ def test_notification_on_solved_puzzle
)
assert(
tickets.messages[0] ==
'500 the last puzzle [#100]() is solved here.',
'500 the only puzzle [#100]() is solved here.',
"Text is wrong: #{tickets.messages[0]}"
)
end
Expand Down Expand Up @@ -187,7 +187,7 @@ def test_notification_on_update
"Wrong about of msgs (#{tickets.messages.length}): #{tickets.messages}"
)
assert(
tickets.messages[0] == '5 the last puzzle [#6](#) is solved here.',
tickets.messages[0] == '5 the only puzzle [#6](#) is solved here.',
"Text is wrong: #{tickets.messages[0]}"
)
end
Expand Down

0 comments on commit 03597c0

Please sign in to comment.