diff --git a/test-assets/puzzles/notify-unknown-open-issues.xml b/test-assets/puzzles/notify-unknown-open-issues.xml new file mode 100644 index 00000000..92811192 --- /dev/null +++ b/test-assets/puzzles/notify-unknown-open-issues.xml @@ -0,0 +1,37 @@ + + + + + 1-abcdef + 5 + + + 5-abcdef + unknown + 5 + + + + diff --git a/test/test_diff.rb b/test/test_diff.rb index 8bebb7d0..4cddb607 100644 --- a/test/test_diff.rb +++ b/test/test_diff.rb @@ -60,6 +60,22 @@ def test_notification_on_one_new_puzzle ) end + def test_notification_unknown_issue + tickets = Tickets.new + xml = File.open('test-assets/puzzles/notify-unknown-open-issues.xml') do |f| + Nokogiri::XML(f) + end + Diff.new(Nokogiri::XML(''), xml).notify(tickets) + assert( + tickets.messages.length == 1, + "Incorrect number of messages: #{tickets.messages.length}" + ) + assert( + tickets.messages[0] == '5 the puzzle [#125](//issue/125) is still not solved.', + "Text is wrong: #{tickets.messages[0]}" + ) + end + def test_notification_on_two_new_puzzles tickets = Tickets.new Diff.new(