lazylead 0.6.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +7 -2
  3. data/.docker/Dockerfile +17 -6
  4. data/.docs/duedate_expired.md +1 -1
  5. data/.rubocop.yml +119 -3
  6. data/.simplecov +1 -1
  7. data/Gemfile +1 -1
  8. data/Guardfile +2 -2
  9. data/Rakefile +7 -4
  10. data/bin/lazylead +4 -2
  11. data/lazylead.gemspec +33 -29
  12. data/lib/lazylead.rb +2 -2
  13. data/lib/lazylead/allocated.rb +1 -1
  14. data/lib/lazylead/cc.rb +22 -21
  15. data/lib/lazylead/cli/app.rb +3 -3
  16. data/lib/lazylead/confluence.rb +10 -3
  17. data/lib/lazylead/email.rb +1 -21
  18. data/lib/lazylead/exchange.rb +17 -29
  19. data/lib/lazylead/home.rb +1 -1
  20. data/lib/lazylead/log.rb +1 -1
  21. data/lib/lazylead/model.rb +25 -17
  22. data/lib/lazylead/opts.rb +68 -3
  23. data/lib/lazylead/postman.rb +14 -19
  24. data/lib/lazylead/requires.rb +38 -0
  25. data/lib/lazylead/salt.rb +2 -1
  26. data/lib/lazylead/schedule.rb +1 -1
  27. data/lib/lazylead/smtp.rb +1 -1
  28. data/lib/lazylead/system/empty.rb +1 -1
  29. data/lib/lazylead/system/fake.rb +1 -1
  30. data/lib/lazylead/system/jira.rb +28 -20
  31. data/lib/lazylead/system/synced.rb +1 -1
  32. data/lib/lazylead/task/accuracy/accuracy.rb +23 -30
  33. data/lib/lazylead/task/accuracy/affected_build.rb +1 -1
  34. data/lib/lazylead/task/accuracy/attachment.rb +3 -7
  35. data/lib/lazylead/task/accuracy/environment.rb +1 -1
  36. data/lib/lazylead/task/accuracy/logs.rb +10 -5
  37. data/lib/lazylead/task/accuracy/onlyll.rb +147 -0
  38. data/lib/lazylead/task/accuracy/records.rb +2 -2
  39. data/lib/lazylead/task/accuracy/requirement.rb +1 -1
  40. data/lib/lazylead/task/accuracy/servers.rb +17 -8
  41. data/lib/lazylead/task/accuracy/stacktrace.rb +2 -2
  42. data/lib/lazylead/task/accuracy/testcase.rb +3 -3
  43. data/lib/lazylead/task/accuracy/wiki.rb +1 -1
  44. data/lib/lazylead/task/{alert.rb → alert/alert.rb} +6 -6
  45. data/lib/lazylead/task/alert/alertif.rb +75 -0
  46. data/lib/lazylead/task/alert/changed_to.rb +58 -0
  47. data/lib/lazylead/task/assignment.rb +1 -1
  48. data/lib/lazylead/task/confluence_ref.rb +1 -1
  49. data/lib/lazylead/task/echo.rb +1 -1
  50. data/lib/lazylead/task/fix_version.rb +5 -3
  51. data/lib/lazylead/task/loading.rb +94 -0
  52. data/lib/lazylead/task/missing_comment.rb +1 -1
  53. data/lib/lazylead/task/propagate_down.rb +4 -4
  54. data/lib/lazylead/task/savepoint.rb +1 -1
  55. data/lib/lazylead/task/svn/diff.rb +6 -14
  56. data/lib/lazylead/task/svn/grep.rb +41 -13
  57. data/lib/lazylead/task/svn/touch.rb +3 -5
  58. data/lib/lazylead/version.rb +2 -2
  59. data/lib/messages/accuracy.erb +1 -1
  60. data/lib/messages/alertif.erb +134 -0
  61. data/lib/messages/created_recently.erb +110 -0
  62. data/lib/messages/illegal_fixversion_change.erb +8 -2
  63. data/lib/messages/loading.erb +117 -0
  64. data/lib/messages/only_ll.erb +107 -0
  65. data/lib/messages/svn_diff_attachment.erb +18 -8
  66. data/lib/messages/svn_grep.erb +1 -1
  67. data/readme.md +3 -3
  68. data/test/lazylead/allocated_test.rb +1 -1
  69. data/test/lazylead/cc_test.rb +2 -1
  70. data/test/lazylead/cli/app_test.rb +2 -2
  71. data/test/lazylead/confluence_test.rb +1 -1
  72. data/test/lazylead/exchange_test.rb +1 -1
  73. data/test/lazylead/model_test.rb +11 -1
  74. data/test/lazylead/opts_test.rb +48 -1
  75. data/test/lazylead/postman_test.rb +9 -6
  76. data/test/lazylead/salt_test.rb +1 -1
  77. data/test/lazylead/smoke_test.rb +14 -1
  78. data/test/lazylead/smtp_test.rb +2 -5
  79. data/test/lazylead/system/jira_test.rb +10 -1
  80. data/test/lazylead/task/accuracy/accuracy_test.rb +1 -1
  81. data/test/lazylead/task/accuracy/affected_build_test.rb +1 -1
  82. data/test/lazylead/task/accuracy/attachment_test.rb +2 -2
  83. data/test/lazylead/task/accuracy/environment_test.rb +1 -1
  84. data/test/lazylead/task/accuracy/logs_test.rb +13 -1
  85. data/test/lazylead/task/accuracy/onlyll_test.rb +138 -0
  86. data/test/lazylead/task/accuracy/records_test.rb +1 -1
  87. data/test/lazylead/task/accuracy/score_test.rb +2 -2
  88. data/test/lazylead/task/accuracy/servers_test.rb +3 -3
  89. data/test/lazylead/task/accuracy/stacktrace_test.rb +1 -1
  90. data/test/lazylead/task/accuracy/testcase_test.rb +28 -1
  91. data/test/lazylead/task/accuracy/wiki_test.rb +1 -1
  92. data/test/lazylead/task/alert/alertif_test.rb +54 -0
  93. data/test/lazylead/task/{assignee_alert_test.rb → alert/assignee_alert_test.rb} +10 -10
  94. data/test/lazylead/task/alert/changed_to_test.rb +42 -0
  95. data/test/lazylead/task/assignment_test.rb +1 -1
  96. data/test/lazylead/task/confluence_ref_test.rb +1 -1
  97. data/test/lazylead/task/created_recently_test.rb +53 -0
  98. data/test/lazylead/task/duedate_test.rb +5 -12
  99. data/test/lazylead/task/echo_test.rb +1 -1
  100. data/test/lazylead/task/fix_version_test.rb +2 -1
  101. data/test/lazylead/task/loading_test.rb +54 -0
  102. data/test/lazylead/task/missing_comment_test.rb +1 -1
  103. data/test/lazylead/task/propagate_down_test.rb +5 -4
  104. data/test/lazylead/task/savepoint_test.rb +10 -7
  105. data/test/lazylead/task/svn/diff_test.rb +1 -1
  106. data/test/lazylead/task/svn/grep_test.rb +44 -2
  107. data/test/lazylead/task/svn/touch_test.rb +1 -1
  108. data/test/lazylead/version_test.rb +1 -1
  109. data/test/sqlite_test.rb +1 -1
  110. data/test/test.rb +8 -9
  111. data/upgrades/sqlite/001-install-main-lazylead-tables.sql +1 -1
  112. data/upgrades/sqlite/999.testdata.sql +3 -2
  113. metadata +133 -58
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -24,6 +24,7 @@
24
24
 
25
25
  require_relative "../test"
26
26
  require_relative "../../lib/lazylead/log"
27
+ require_relative "../../lib/lazylead/opts"
27
28
  require_relative "../../lib/lazylead/salt"
28
29
  require_relative "../../lib/lazylead/smtp"
29
30
  require_relative "../../lib/lazylead/postman"
@@ -46,11 +47,13 @@ module Lazylead
46
47
  smtp_pass: ENV["LL_SMTP_PASS"]
47
48
  ).enable
48
49
  Postman.new.send(
49
- "to" => ENV["LL_SMTP_TO"],
50
- "from" => ENV["LL_SMTP_FROM"],
51
- "attachments" => ["readme.md"],
52
- "subject" => "[LL] Attachments",
53
- "template" => "lib/messages/savepoint.erb"
50
+ Opts.new(
51
+ "to" => ENV["LL_SMTP_TO"],
52
+ "from" => ENV["LL_SMTP_FROM"],
53
+ "attachments" => ["readme.md"],
54
+ "subject" => "[LL] Attachments",
55
+ "template" => "lib/messages/savepoint.erb"
56
+ )
54
57
  )
55
58
  end
56
59
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -22,6 +22,8 @@
22
22
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
+ require "inifile"
26
+ require "tempfile"
25
27
  require_relative "../test"
26
28
 
27
29
  module Lazylead
@@ -34,5 +36,16 @@ module Lazylead
34
36
  test "ENV has no key" do
35
37
  refute env? "c"
36
38
  end
39
+ test "ini file found" do
40
+ Tempfile.create do |f|
41
+ f << "EnvTest=value"
42
+ f.flush
43
+ IniFile.new(filename: f).each { |_, k, v| ENV[k] = v }
44
+ assert_equal "value", ENV["EnvTest"]
45
+ end
46
+ end
47
+ test "ini file not found" do
48
+ assert_empty IniFile.new(filename: "absent.ini").to_h
49
+ end
37
50
  end
38
51
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -38,10 +38,7 @@ module Lazylead
38
38
  subject "The fake!"
39
39
  body "Fake body"
40
40
  end
41
- assert_equal 1,
42
- Mail::TestMailer.deliveries
43
- .filter { |m| m.subject.eql? "The fake!" }
44
- .length
41
+ assert_equal(1, Mail::TestMailer.deliveries.count { |m| m.subject.eql? "The fake!" })
45
42
  end
46
43
 
47
44
  # @todo #43/DEV email-related properties should be exported to the CI env
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -185,5 +185,14 @@ module Lazylead
185
185
  .issues("key>DATAJDBC-500")
186
186
  .size >= 118
187
187
  end
188
+
189
+ test "connected based on string properties" do
190
+ refute_empty Jira.new(
191
+ "username" => nil,
192
+ "password" => nil,
193
+ "site" => "https://jira.spring.io",
194
+ "context_path" => ""
195
+ ).issues("key=DATAJDBC-480")
196
+ end
188
197
  end
189
198
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -34,7 +34,7 @@ module Lazylead
34
34
  super "", 0, ""
35
35
  end
36
36
 
37
- def matching(attach)
37
+ def matches?(attach)
38
38
  "ConfigServerLogWithException.txt".eql? attach.attrs["filename"]
39
39
  end
40
40
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -134,5 +134,17 @@ module Lazylead
134
134
  )
135
135
  )
136
136
  end
137
+
138
+ test "filename contain word logs" do
139
+ assert Logs.new.passed(
140
+ OpenStruct.new(
141
+ attachments: [
142
+ OpenStruct.new(
143
+ attrs: { "size" => 10_241, "filename" => "the some logs]here.gz" }
144
+ )
145
+ ]
146
+ )
147
+ )
148
+ end
137
149
  end
138
150
  end
@@ -0,0 +1,138 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ require_relative "../../../test"
26
+ require_relative "../../../../lib/lazylead/opts"
27
+ require_relative "../../../../lib/lazylead/smtp"
28
+ require_relative "../../../../lib/lazylead/postman"
29
+ require_relative "../../../../lib/lazylead/system/jira"
30
+ require_relative "../../../../lib/lazylead/task/accuracy/onlyll"
31
+
32
+ module Lazylead
33
+ class OnlyLLTest < Lazylead::Test
34
+ # In current tests the grid label is 'PullRequest'.
35
+ # The default grid labels are 0%, 10%, 20%, etc., the reason why
36
+ # 'PullRequest' label is used here as we don't have 0%, 10%, etc.
37
+ # on https://jira.spring.io.
38
+ test "grid label found" do
39
+ assert Labels.new(
40
+ NoAuthJira.new("https://jira.spring.io").issues("key=XD-3725").first,
41
+ Opts.new("grid" => "PullRequest, ,")
42
+ ).exists?
43
+ end
44
+
45
+ test "grid label set by ll" do
46
+ assert Labels.new(
47
+ NoAuthJira.new("https://jira.spring.io")
48
+ .issues("key=XD-3725", expand: "changelog")
49
+ .first,
50
+ Opts.new("grid" => "PullRequest", "author" => "grussell")
51
+ ).valid?
52
+ end
53
+
54
+ test "email notification" do
55
+ Lazylead::Smtp.new.enable
56
+ Lazylead::Task::OnlyLL.new.run(
57
+ NoAuthJira.new("https://jira.spring.io"),
58
+ Postman.new,
59
+ Opts.new(
60
+ "from" => "ll@fake.com",
61
+ "to" => "lead@fake.com",
62
+ "grid" => "PullRequest",
63
+ "author" => "LL",
64
+ "jql" => "key=XD-3725",
65
+ "max_results" => 200,
66
+ "subject" => "[LL] Only",
67
+ "fields" => "priority,summary,reporter,labels",
68
+ "template" => "lib/messages/only_ll.erb"
69
+ )
70
+ )
71
+ assert_email "[LL] Only",
72
+ %w[XD-3725 Blocker EmbeddedHeadersMessageConverter]
73
+ end
74
+
75
+ test "detect score" do
76
+ assert_equal "PullRequest",
77
+ Labels.new(
78
+ NoAuthJira.new("https://jira.spring.io")
79
+ .issues("key=XD-3725", expand: "changelog")
80
+ .first,
81
+ Opts.new(
82
+ "grid" => "PullRequest",
83
+ "author" => "grussell"
84
+ )
85
+ ).score
86
+ end
87
+
88
+ test "multiple scores in the same ticket" do
89
+ assert_equal "10%",
90
+ Labels.new(
91
+ Struct.new(:key) do
92
+ def history
93
+ [{ "id" => "287906", "author" => { "self" => "https://jira.spring.io/rest/api/2/user?username=sy", "name" => "sy", "key" => "sy", "emailAddress" => "san at pivotal dot io", "avatarUrls" => { "48x48" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=48", "24x24" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=24", "16x16" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=16", "32x32" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=32" }, "displayName" => "sy an", "active" => true, "timeZone" => "America/Los_Angeles" }, "created" => "2015-12-17T18:12:35.853+0000", "items" => [{ "field" => "Fix Version", "fieldtype" => "jira", "from" => nil, "fromString" => nil, "to" => "15424", "toString" => "1.3.1" }] }, { "id" => "287913", "author" => { "self" => "https://jira.spring.io/rest/api/2/user?username=ll", "name" => "ll", "key" => "ll", "emailAddress" => "ll at pivotal dot io", "avatarUrls" => { "48x48" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=48", "24x24" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=24", "16x16" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=16", "32x32" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=32" }, "displayName" => "Y LL", "active" => true, "timeZone" => "America/New_York" }, "created" => "2015-12-17T18:14:34.085+0000", "items" => [{ "field" => "assignee", "fieldtype" => "jira", "from" => nil, "fromString" => nil, "to" => "ll", "toString" => "Y LL" }] }, { "id" => "287915", "author" => { "self" => "https://jira.spring.io/rest/api/2/user?username=sy", "name" => "sy", "key" => "sy", "emailAddress" => "san at pivotal dot io", "avatarUrls" => { "48x48" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=48", "24x24" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=24", "16x16" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=16", "32x32" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=32" }, "displayName" => "sy an", "active" => true, "timeZone" => "America/Los_Angeles" }, "created" => "2015-12-17T18:19:36.118+0000", "items" => [{ "field" => "Sprint", "fieldtype" => "custom", "from" => nil, "fromString" => nil, "to" => "106", "toString" => "Sprint 64" }] }, { "id" => "287916", "author" => { "self" => "https://jira.spring.io/rest/api/2/user?username=sy", "name" => "sy", "key" => "sy", "emailAddress" => "san at pivotal dot io", "avatarUrls" => { "48x48" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=48", "24x24" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=24", "16x16" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=16", "32x32" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=32" }, "displayName" => "sy an", "active" => true, "timeZone" => "America/Los_Angeles" }, "created" => "2015-12-17T18:19:36.162+0000", "items" => [{ "field" => "Rank", "fieldtype" => "custom", "from" => "", "fromString" => "", "to" => "", "toString" => "Ranked higher" }] }, { "id" => "287921", "author" => { "self" => "https://jira.spring.io/rest/api/2/user?username=ll", "name" => "ll", "key" => "ll", "emailAddress" => "ll at pivotal dot io", "avatarUrls" => { "48x48" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=48", "24x24" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=24", "16x16" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=16", "32x32" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=32" }, "displayName" => "Y LL", "active" => true, "timeZone" => "America/New_York" }, "created" => "2015-12-17T18:30:47.508+0000", "items" => [{ "field" => "status", "fieldtype" => "jira", "from" => "10000", "fromString" => "To Do", "to" => "3", "toString" => "In Progress" }] }, { "id" => "287922", "author" => { "self" => "https://jira.spring.io/rest/api/2/user?username=ll", "name" => "ll", "key" => "ll", "emailAddress" => "ll at pivotal dot io", "avatarUrls" => { "48x48" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=48", "24x24" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=24", "16x16" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=16", "32x32" => "https://www.gravatar.com/avatar/0037f772e271b0d90bd62361768cb820?d=mm&s=32" }, "displayName" => "Y LL", "active" => true, "timeZone" => "America/New_York" }, "created" => "2015-12-17T18:31:54.137+0000", "items" => [{ "field" => "Pull Request URL", "fieldtype" => "custom", "from" => nil, "fromString" => nil, "to" => nil, "toString" => "https://github.com/spring-projects/spring-xd/pull/1872" }, { "field" => "labels", "fieldtype" => "jira", "from" => nil, "fromString" => "", "to" => nil, "toString" => "10% 20%" }] }, { "id" => "288214", "author" => { "self" => "https://jira.spring.io/rest/api/2/user?username=sy", "name" => "sy", "key" => "sy", "emailAddress" => "san at pivotal dot io", "avatarUrls" => { "48x48" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=48", "24x24" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=24", "16x16" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=16", "32x32" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=32" }, "displayName" => "sy an", "active" => true, "timeZone" => "America/Los_Angeles" }, "created" => "2015-12-25T00:16:09.649+0000", "items" => [{ "field" => "status", "fieldtype" => "jira", "from" => "3", "fromString" => "In Progress", "to" => "10006", "toString" => "In PR" }] }, { "id" => "288215", "author" => { "self" => "https://jira.spring.io/rest/api/2/user?username=sy", "name" => "sy", "key" => "sy", "emailAddress" => "san at pivotal dot io", "avatarUrls" => { "48x48" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=48", "24x24" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=24", "16x16" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=16", "32x32" => "https://www.gravatar.com/avatar/f0373ebca801ca4b2746732b451f497c?d=mm&s=32" }, "displayName" => "sy an", "active" => true, "timeZone" => "America/Los_Angeles" }, "created" => "2015-12-25T00:16:17.499+0000", "items" => [{ "field" => "Actual Story Points", "fieldtype" => "custom", "from" => nil, "fromString" => nil, "to" => nil, "toString" => "1" }, { "field" => "resolution", "fieldtype" => "jira", "from" => nil, "fromString" => nil, "to" => "8", "toString" => "Complete" }, { "field" => "status", "fieldtype" => "jira", "from" => "10006", "fromString" => "In PR", "to" => "10001", "toString" => "Done" }] }]
94
+ end
95
+ end.new("XD-3725"),
96
+ Opts.new("grid" => "10%,20%,30%", "author" => "ll")
97
+ ).score
98
+ end
99
+
100
+ test "sort of percents" do
101
+ assert_equal %w[10% 20% 30%], %w[30% 10% 20%].sort
102
+ end
103
+
104
+ test "ensure that violators found" do
105
+ assert_equal "Aron set 40%",
106
+ Labels.new(
107
+ Struct.new(:key) do
108
+ def history
109
+ [
110
+ { "author" => { "name" => "sy", "key" => "sy", "displayName" => "S N" }, "items" => [{ "field" => "Fix Version", "fieldtype" => "jira", "from" => nil, "fromString" => nil, "to" => "15424", "toString" => "1.3.1" }] },
111
+ { "author" => { "name" => "ll", "key" => "ll", "displayName" => "L L" }, "items" => [{ "field" => "assignee", "fieldtype" => "jira", "from" => nil, "fromString" => nil, "to" => "ll", "toString" => "ll" }] },
112
+ { "author" => { "name" => "sy", "key" => "sy", "displayName" => "S N" }, "items" => [{ "field" => "Sprint", "fieldtype" => "custom", "from" => nil, "fromString" => nil, "to" => "106", "toString" => "Sprint 64" }] },
113
+ { "author" => { "name" => "sy", "key" => "sy", "displayName" => "S N" }, "items" => [{ "field" => "Rank", "fieldtype" => "custom", "from" => "", "fromString" => "", "to" => "", "toString" => "Ranked higher" }] },
114
+ { "author" => { "name" => "ll", "key" => "ll", "displayName" => "L L" }, "items" => [{ "field" => "status", "fieldtype" => "jira", "from" => "10000", "fromString" => "To Do", "to" => "3", "toString" => "In Progress" }] },
115
+ { "author" => { "name" => "ll", "key" => "ll", "displayName" => "L L" }, "items" => [{ "field" => "assignee", "fieldtype" => "jira", "from" => nil, "fromString" => nil, "to" => "ll", "toString" => "ll" }, { "field" => "labels", "fieldtype" => "jira", "from" => nil, "fromString" => "", "to" => nil, "toString" => "20%" }] },
116
+ { "author" => { "name" => "sy", "key" => "sy", "displayName" => "S N" }, "items" => [{ "field" => "Actual Story Points", "fieldtype" => "custom", "from" => nil, "fromString" => nil, "to" => nil, "toString" => "1" }, { "field" => "resolution", "fieldtype" => "jira", "from" => nil, "fromString" => nil, "to" => "8", "toString" => "Complete" }, { "field" => "status", "fieldtype" => "jira", "from" => "10006", "fromString" => "In PR", "to" => "10001", "toString" => "Done" }] },
117
+ { "author" => { "name" => "ap", "key" => "ap", "displayName" => "Aron" }, "items" => [{ "field" => "labels", "fieldtype" => "jira", "from" => nil, "fromString" => "", "to" => nil, "toString" => "abc 40%" }] },
118
+ { "author" => { "name" => "sy", "key" => "sy", "displayName" => "S N" }, "items" => [{ "field" => "status", "fieldtype" => "jira", "from" => "3", "fromString" => "In Progress", "to" => "10006", "toString" => "In PR" }] }
119
+ ]
120
+ end
121
+ end.new("XD-3725"),
122
+ Opts.new("grid" => "10%,20%,30%,40%", "author" => "ll")
123
+ ).violators.first
124
+ end
125
+
126
+ test "violators should consider already existing LL grid labels" do
127
+ assert_equal "Aron set 40%",
128
+ Labels.new(
129
+ Struct.new(:key) do
130
+ def history
131
+ [{ "author" => { "name" => "ap", "key" => "ap", "displayName" => "Aron" }, "items" => [{ "field" => "labels", "fromString" => "0%", "toString" => "0% abc 40%" }] }]
132
+ end
133
+ end.new("XD-3725"),
134
+ Opts.new("grid" => "10%,20%,30%,40%", "author" => "ll")
135
+ ).violators.first
136
+ end
137
+ end
138
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -39,7 +39,7 @@ module Lazylead
39
39
  "100": "100"
40
40
  }.each do |k, v|
41
41
  assert_equal v.to_f,
42
- Lazylead::Score.new({}, {}, {}).grade(k.to_s.to_f)
42
+ Lazylead::Score.new({}, {}).grade(k.to_s.to_f)
43
43
  end
44
44
  end
45
45
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -42,7 +42,7 @@ module Lazylead
42
42
  end
43
43
 
44
44
  test "url to failed entity found in description" do
45
- assert Servers.new(envs: [%r{(http|https):\/\/\w+\:\d+\/.{10,}}]).passed(
45
+ assert Servers.new(envs: [%r{(http|https)://\w+:\d+/.{10,}}]).passed(
46
46
  Task.new(
47
47
  "1. Open the dedicated app
48
48
  2. Click on https://server:6900/object?id=2000
@@ -53,7 +53,7 @@ module Lazylead
53
53
  end
54
54
 
55
55
  test "url to failed entity not present in description" do
56
- refute Servers.new(envs: [%r{(http|https):\/\/\w+\:\d+\/.{10,}}]).passed(
56
+ refute Servers.new(envs: [%r{(http|https)://\w+:\d+/.{10,}}]).passed(
57
57
  Task.new(
58
58
  "1. Open the dedicated app
59
59
  2. Click on https://server:6900/
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -246,6 +246,33 @@ module Lazylead
246
246
  *{color:#DE10AA}[AR]{color}* = YYYY"
247
247
  end
248
248
 
249
+ test "tc" do
250
+ assert testcase? "*TC*
251
+ # Step 1
252
+ # Step ..
253
+ # Step N
254
+ *{color:#00673A}[ER]{color}* = XXXX
255
+ *{color:#DE10AA}[AR]{color}* = YYYY"
256
+ end
257
+
258
+ test "testcases" do
259
+ assert testcase? "*Test cases*
260
+ # Step 1
261
+ # Step ..
262
+ # Step N
263
+ *{color:#00673A}[ER]{color}* = XXXX
264
+ *{color:#DE10AA}[AR]{color}* = YYYY"
265
+ end
266
+
267
+ test "TC with underline" do
268
+ assert testcase? "{color:#0747a6}+*Test Steps:*+{color}
269
+ # Step 1
270
+ # Step ..
271
+ # Step N
272
+ *{color:#00673A}[ER]{color}* = XXXX
273
+ *{color:#DE10AA}[AR]{color}* = YYYY"
274
+ end
275
+
249
276
  # ensure that issue description has a test case, AR and ER
250
277
  def testcase?(desc)
251
278
  Testcase.new.passed(OpenStruct.new(description: desc))