lazylead 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.0pdd.yml +4 -1
  3. data/.docs/accuracy.md +107 -0
  4. data/.docs/accuracy_email.jpg +0 -0
  5. data/.docs/accuracy_jira_comment.jpg +0 -0
  6. data/.docs/propagate_down.md +1 -1
  7. data/.pdd +1 -1
  8. data/.rubocop.yml +6 -0
  9. data/bin/lazylead +6 -3
  10. data/lazylead.gemspec +4 -4
  11. data/lib/lazylead/exchange.rb +1 -1
  12. data/lib/lazylead/log.rb +30 -8
  13. data/lib/lazylead/model.rb +44 -22
  14. data/lib/lazylead/opts.rb +68 -0
  15. data/lib/lazylead/postman.rb +1 -1
  16. data/lib/lazylead/schedule.rb +3 -3
  17. data/lib/lazylead/smtp.rb +1 -1
  18. data/lib/lazylead/system/jira.rb +16 -14
  19. data/lib/lazylead/system/synced.rb +2 -1
  20. data/lib/lazylead/task/accuracy/accuracy.rb +140 -0
  21. data/lib/lazylead/task/accuracy/affected_build.rb +43 -0
  22. data/lib/lazylead/task/accuracy/requirement.rb +40 -0
  23. data/lib/lazylead/task/alert.rb +8 -6
  24. data/lib/lazylead/task/confluence_ref.rb +4 -3
  25. data/lib/lazylead/task/echo.rb +4 -0
  26. data/lib/lazylead/task/fix_version.rb +10 -6
  27. data/lib/lazylead/task/missing_comment.rb +7 -5
  28. data/lib/lazylead/task/propagate_down.rb +11 -3
  29. data/lib/lazylead/task/savepoint.rb +1 -1
  30. data/lib/lazylead/task/touch.rb +102 -0
  31. data/lib/lazylead/version.rb +1 -1
  32. data/lib/messages/accuracy.erb +118 -0
  33. data/lib/messages/svn_touch.erb +147 -0
  34. data/readme.md +17 -16
  35. data/test/lazylead/cc_test.rb +2 -2
  36. data/test/lazylead/cli/app_test.rb +2 -2
  37. data/test/lazylead/exchange_test.rb +3 -3
  38. data/test/lazylead/model_test.rb +4 -4
  39. data/test/lazylead/opts_test.rb +66 -0
  40. data/test/lazylead/postman_test.rb +1 -1
  41. data/test/lazylead/smtp_test.rb +1 -1
  42. data/test/lazylead/system/jira_test.rb +35 -1
  43. data/test/lazylead/task/accuracy/accuracy_test.rb +73 -0
  44. data/test/lazylead/task/accuracy/affected_build_test.rb +42 -0
  45. data/test/lazylead/task/assignee_alert_test.rb +2 -2
  46. data/test/lazylead/task/duedate_test.rb +36 -26
  47. data/test/lazylead/task/fix_version_test.rb +9 -6
  48. data/test/lazylead/task/missing_comment_test.rb +11 -9
  49. data/test/lazylead/task/propagate_down_test.rb +4 -2
  50. data/test/lazylead/task/touch_test.rb +63 -0
  51. data/upgrades/sqlite/999.testdata.sql +2 -1
  52. metadata +25 -7
data/readme.md CHANGED
@@ -38,6 +38,7 @@ Join our telegram group [lazylead.org](https://t.me/lazyleads) for discussions.
38
38
  | [Notify about illegal "Fix Version" modification](lib/lazylead/task/fix_version.rb) | ✅ | ❌ | ❌ |
39
39
  | [Expected comment in ticket is missing](lib/lazylead/task/missing_comment.rb) | ✅ | ⌛ | ⌛ |
40
40
  | [Propagate some fields from parent ticket into sub-tasks](.docs/propagate_down.md) | ✅ | ❌ | ❌ |
41
+ | [Evaluate the ticket formatting accuracy](.docs/accuracy.md) | ✅ | ⌛ | ⌛ |
41
42
  | Print the current capacity of team into newly created tasks | ⌛ | ⌛ | ⌛ |
42
43
  | Create/retrofit the defect automatically into latest release | ⌛ | ⌛ | ❌ |
43
44
  | [Notify about expired(ing) due dates](.docs/duedate_expired.md) | ✅ | ❌ | ⌛ |
@@ -112,13 +113,14 @@ For simplicity, we are using [docker-compose](https://docs.docker.com/compose/):
112
113
  ll > docker-compose -f .github/tasks.yml up
113
114
  Creating lazylead ... done
114
115
  Attaching to lazylead
115
- lazylead | [2020-06-06T10:35:13] DEBUG Memory footprint at start is 52MB
116
- lazylead | [2020-06-06T10:35:13] DEBUG Database: '/lazylead/db/ll.db', sql migration dir: '/lazylead/upgrades/sqlite'
117
- lazylead | [2020-06-06T10:35:13] DEBUG Migration applied to /lazylead/db/ll.db from /lazylead/upgrades/sqlite
118
- lazylead | [2020-06-06T10:35:13] DEBUG Database connection established
119
- lazylead | [2020-06-06T10:35:13] WARN SMTP connection enabled in test mode.
120
- lazylead | [2020-06-06T10:35:13] WARN ll-001: No tasks found.
121
- lazylead | [2020-06-06T10:35:13] DEBUG Memory footprint at the end is 66MB
116
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Version: 0.4.0
117
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Memory footprint at start is 52MB
118
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Database: '/lazylead/db/ll.db', sql migration dir: '/lazylead/upgrades/sqlite'
119
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Migration applied to /lazylead/db/ll.db from /lazylead/upgrades/sqlite
120
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Database connection established
121
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] SMTP connection established with {host} as {user}.
122
+ lazylead | [2020-08-09T06:17:32] WARN [main] ll-001: No tasks found.
123
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Memory footprint at the end is 67MB
122
124
  lazylead exited with code 0
123
125
  ll >
124
126
  ```
@@ -152,15 +154,14 @@ For simplicity, we are using [docker-compose](https://docs.docker.com/compose/):
152
154
  check the logs and stop container if needed
153
155
  ```bash
154
156
  ll > docker logs lazylead
155
- 2020-06-06T11:37:36] DEBUG Memory footprint at start is 52MB
156
- [2020-06-06T11:37:37] DEBUG Database: '/lazylead/db/ll.db', sql migration dir: '/lazylead/upgrades/sqlite'
157
- [2020-06-06T11:37:37] DEBUG Migration applied to /lazylead/db/ll.db from /lazylead/upgrades/sqlite
158
- [2020-06-06T11:37:37] DEBUG Database connection established
159
- [2020-06-06T11:37:37] WARN SMTP connection enabled in test mode.
160
- [2020-06-06T11:37:37] DEBUG Task scheduled: id='1', name='Expired due dates', cron='0 8 * * 1-5', system='1', action='Lazylead::Task::AssigneeAlert', team_id='1', description='', enabled='true', properties='{"sql":"filter=555", "cc":"my.email@google.com", "subject":"[LL] Expired due dates", "template":"lib/messages/due_date_expired.erb", "postman":"Lazylead::Exchange"}'
157
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Version: 0.4.0
158
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Memory footprint at start is 52MB
159
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Database: '/lazylead/db/ll.db', sql migration dir: '/lazylead/upgrades/sqlite'
160
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Migration applied to /lazylead/db/ll.db from /lazylead/upgrades/sqlite
161
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Database connection established
162
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] SMTP connection established with {host} as {user}.
163
+ lazylead | [2020-08-09T06:17:32] DEBUG [main] Task scheduled: id='1', name='Expired due dates', cron='0 8 * * 1-5', system='1', action='Lazylead::Task::AssigneeAlert', team_id='1', description='', enabled='true', properties='{"sql":"filter=555", "cc":"my.email@google.com", "subject":"[LL] Expired due dates", "template":"lib/messages/due_date_expired.erb", "postman":"Lazylead::Exchange"}'
161
164
  ...
162
- ll > docker stop lazylead
163
- lazylead
164
165
  ```
165
166
 
166
167
  ### How to contribute?
@@ -173,4 +174,4 @@ bundle exec rake
173
174
  Everyone interacting in this project’s codebases, issue trackers, chat rooms is expected to follow the [code of conduct](.github/CODE_OF_CONDUCT.md).
174
175
 
175
176
  Contributors:
176
- * [dgroup](https://github.com/dgroup) as Yurii Dubinka (yurii.dubinka@gmail.com)
177
+ * [dgroup](https://github.com/dgroup) as Yurii Dubinka ([yurii.dubinka@gmail.com](mailto:yurii.dubinka@gmail.com))
@@ -129,7 +129,7 @@ module Lazylead
129
129
  end
130
130
 
131
131
  test "detect plain cc" do
132
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
132
+ CLI::App.new(Log.new, NoSchedule.new).run(
133
133
  home: ".",
134
134
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
135
135
  vcs4sql: "upgrades/sqlite",
@@ -140,7 +140,7 @@ module Lazylead
140
140
  end
141
141
 
142
142
  test "detect complex cc by predefined component" do
143
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
143
+ CLI::App.new(Log.new, NoSchedule.new).run(
144
144
  home: ".",
145
145
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
146
146
  vcs4sql: "upgrades/sqlite",
@@ -31,7 +31,7 @@ module Lazylead
31
31
  module CLI
32
32
  class AppTest < Lazylead::SqliteTest
33
33
  test "LL database structure installed successfully" do
34
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
34
+ CLI::App.new(Log.new, NoSchedule.new).run(
35
35
  home: ".",
36
36
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
37
37
  vcs4sql: "upgrades/sqlite"
@@ -46,7 +46,7 @@ module Lazylead
46
46
  end
47
47
 
48
48
  test "activesupport is activated for access to domain entities" do
49
- CLI::App.new(Log::NOTHING, Schedule.new(Log::NOTHING, false)).run(
49
+ CLI::App.new(Log.new, Schedule.new(cling: false)).run(
50
50
  home: ".",
51
51
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
52
52
  vcs4sql: "upgrades/sqlite",
@@ -36,7 +36,7 @@ module Lazylead
36
36
  "exchange_user",
37
37
  "exchange_password",
38
38
  "exchange_to"
39
- Exchange.new(Log::NOTHING, NoSalt.new).send(
39
+ Exchange.new(Log.new, NoSalt.new).send(
40
40
  to: ENV["exchange_to"],
41
41
  tickets: NoAuthJira.new("https://jira.spring.io")
42
42
  .issues("key = DATAJDBC-480"),
@@ -52,7 +52,7 @@ module Lazylead
52
52
  "enc_exchange_psw",
53
53
  "enc_exchange_to"
54
54
  Exchange.new(
55
- Log::NOTHING,
55
+ Log.new,
56
56
  Salt.new("exchange_salt"),
57
57
  "exchange_url" => ENV["exchange_url"],
58
58
  "exchange_user" => ENV["enc_exchange_usr"],
@@ -72,7 +72,7 @@ module Lazylead
72
72
  "exchange_password",
73
73
  "exchange_to"
74
74
  Exchange.new(
75
- Log::NOTHING,
75
+ Log.new,
76
76
  Salt.new("exchange_salt"),
77
77
  "exchange_url" => ENV["exchange_url"],
78
78
  "exchange_user" => ENV["enc_exchange_usr"],
@@ -31,7 +31,7 @@ require_relative "../../lib/lazylead/schedule"
31
31
  module Lazylead
32
32
  class OrmTest < Lazylead::SqliteTest
33
33
  test "convert column to json" do
34
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
34
+ CLI::App.new(Log.new, NoSchedule.new).run(
35
35
  home: ".",
36
36
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
37
37
  vcs4sql: "upgrades/sqlite",
@@ -42,7 +42,7 @@ module Lazylead
42
42
 
43
43
  test "env properties injected" do
44
44
  ENV["usr"] = "Mike"
45
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
45
+ CLI::App.new(Log.new, NoSchedule.new).run(
46
46
  home: ".",
47
47
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
48
48
  vcs4sql: "upgrades/sqlite",
@@ -53,7 +53,7 @@ module Lazylead
53
53
  end
54
54
 
55
55
  test "postman initiated through orm" do
56
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
56
+ CLI::App.new(Log.new, NoSchedule.new).run(
57
57
  home: ".",
58
58
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
59
59
  vcs4sql: "upgrades/sqlite",
@@ -64,7 +64,7 @@ module Lazylead
64
64
 
65
65
  test "task properties are using ENV variables" do
66
66
  ENV["key171"] = "value"
67
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
67
+ CLI::App.new(Log.new, NoSchedule.new).run(
68
68
  home: ".",
69
69
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
70
70
  vcs4sql: "upgrades/sqlite",
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2020 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
+
28
+ module Lazylead
29
+ class OptsTest < Lazylead::Test
30
+ test "able to read by symbol" do
31
+ assert_equal "1", Opts.new(one: "1", two: "2")[:one]
32
+ end
33
+
34
+ test "able to read by key" do
35
+ assert_equal "1", Opts.new("one" => "1", two: "2")["one"]
36
+ end
37
+
38
+ test "able to write by key" do
39
+ opts = Opts.new
40
+ opts["key"] = "value"
41
+ assert_equal "value", opts["key"]
42
+ end
43
+
44
+ test "has jira defaults" do
45
+ assert_entries(
46
+ {
47
+ max_results: 50
48
+ },
49
+ Opts.new.jira_defaults
50
+ )
51
+ end
52
+
53
+ test "split and trim" do
54
+ assert_equal %w[one two three],
55
+ Opts.new("text" => " one,two ,three, ,\n").slice("text", ",")
56
+ end
57
+
58
+ test "blank for null value cases" do
59
+ assert Opts.new("one" => "1", "two" => nil).blank? "two"
60
+ end
61
+
62
+ test "to hash" do
63
+ assert_kind_of Hash, Opts.new("one" => "1", "two" => nil).to_h
64
+ end
65
+ end
66
+ end
@@ -38,7 +38,7 @@ module Lazylead
38
38
  "LL_SMTP_TO",
39
39
  "LL_SMTP_FROM"
40
40
  Smtp.new(
41
- Log::NOTHING,
41
+ Log.new,
42
42
  NoSalt.new,
43
43
  smtp_host: ENV["LL_SMTP_HOST"],
44
44
  smtp_port: ENV["LL_SMTP_PORT"],
@@ -48,7 +48,7 @@ module Lazylead
48
48
  test "email has been sent to the remote server" do
49
49
  skip "Not implemented yet" unless env? "LL_SMTP_HOST", "LL_SMTP_USER"
50
50
  Smtp.new(
51
- Log::NOTHING, NoSalt.new,
51
+ Log.new, NoSalt.new,
52
52
  smtp_host: ENV["LL_SMTP_HOST"],
53
53
  smtp_port: ENV["LL_SMTP_PORT"],
54
54
  smtp_user: ENV["LL_SMTP_USER"],
@@ -40,7 +40,7 @@ module Lazylead
40
40
 
41
41
  test "found issue by jira (ORM)" do
42
42
  skip "No Jira credentials provided" unless env? "jsi_usr", "jsi_psw"
43
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
43
+ CLI::App.new(Log.new, NoSchedule.new).run(
44
44
  home: ".",
45
45
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
46
46
  vcs4sql: "upgrades/sqlite",
@@ -114,5 +114,39 @@ module Lazylead
114
114
  .first
115
115
  .status
116
116
  end
117
+
118
+ test "issue has 1 field" do
119
+ assert_equal 1,
120
+ NoAuthJira.new("https://jira.spring.io")
121
+ .issues("key='DATAJDBC-480'", fields: ["summary"])
122
+ .first
123
+ .fields
124
+ .size
125
+ end
126
+
127
+ test "make an jira comment" do
128
+ issue = Struct.new(:comment) do
129
+ def comments
130
+ self
131
+ end
132
+
133
+ def build
134
+ self
135
+ end
136
+
137
+ def save!(body)
138
+ self[:comment] = body
139
+ end
140
+ end.new
141
+ Issue.new(issue, Fake.new).post("Hi there!")
142
+ assert_equal "Hi there!", issue.comment[:body]
143
+ end
144
+
145
+ test "search by limit in 1 issue" do
146
+ assert_equal 1,
147
+ NoAuthJira.new("https://jira.spring.io")
148
+ .issues("key in (DATAJDBC-480, DATAJDBC-500)", max_results: "1")
149
+ .size
150
+ end
117
151
  end
118
152
  end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2020 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/smtp"
27
+ require_relative "../../../../lib/lazylead/task/accuracy/accuracy"
28
+ require_relative "../../../../lib/lazylead/opts"
29
+ require_relative "../../../../lib/lazylead/postman"
30
+ require_relative "../../../../lib/lazylead/cli/app"
31
+ require_relative "../../../../lib/lazylead/system/jira"
32
+
33
+ module Lazylead
34
+ class AccuracyTest < Lazylead::Test
35
+ test "detect affected build" do
36
+ Lazylead::Smtp.new.enable
37
+ Task::Accuracy.new.run(
38
+ NoAuthJira.new("https://jira.spring.io"),
39
+ Postman.new,
40
+ Opts.new(
41
+ "from" => "ll@fake.com",
42
+ "to" => "lead@fake.com",
43
+ "rules" => "Lazylead::RequirementAffectedBuild",
44
+ "silent" => "true",
45
+ "colors" => {
46
+ "0" => "#FF4F33",
47
+ "35" => "#FF9F33",
48
+ "57" => "#19DD1E",
49
+ "90" => "#0FA81A"
50
+ }.to_json.to_s,
51
+ "docs" => "https://github.com/dgroup/lazylead/blob/master/.github/ISSUE_TEMPLATE/bug_report.md",
52
+ "jql" => "key in (DATAJDBC-490, DATAJDBC-492, DATAJDBC-493)",
53
+ "max_results" => 200,
54
+ "subject" => "[LL] Raised tickets",
55
+ "template" => "lib/messages/accuracy.erb"
56
+ )
57
+ )
58
+ assert_email "[LL] Raised tickets",
59
+ %w[DATAJDBC-493 0.5 100% MyeongHyeonLee Deadlock\ occurs]
60
+ end
61
+
62
+ test "construct accuracy from orm" do
63
+ CLI::App.new(Log.new, NoSchedule.new).run(
64
+ home: ".",
65
+ sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
66
+ vcs4sql: "upgrades/sqlite",
67
+ testdata: true
68
+ )
69
+ assert_kind_of Lazylead::Task::Accuracy,
70
+ ORM::Task.find(195).action.constantize.new
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2020 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/task/accuracy/affected_build"
27
+
28
+ module Lazylead
29
+ class AffectedBuildTest < Lazylead::Test
30
+ test "affected version absent" do
31
+ refute RequirementAffectedBuild.new.passed(
32
+ OpenStruct.new(fields: { "versions" => [] })
33
+ )
34
+ end
35
+
36
+ test "affected version provided" do
37
+ assert RequirementAffectedBuild.new.passed(
38
+ OpenStruct.new(fields: { "versions" => ["0.4.0"] })
39
+ )
40
+ end
41
+ end
42
+ end
@@ -34,8 +34,8 @@ require_relative "../../../lib/lazylead/task/alert"
34
34
 
35
35
  module Lazylead
36
36
  class AssigneeAlertTest < Lazylead::Test
37
- test "issue #154: undefined method to_hash for nil object" do
38
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
37
+ test "issue #154 undefined method to_hash for nil object" do
38
+ CLI::App.new(Log.new, NoSchedule.new).run(
39
39
  home: ".",
40
40
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
41
41
  vcs4sql: "upgrades/sqlite",
@@ -41,10 +41,12 @@ module Lazylead
41
41
  Task::AssigneeAlert.new.run(
42
42
  NoAuthJira.new("https://jira.spring.io"),
43
43
  Postman.new,
44
- "from" => "fake@email.com",
45
- "sql" => "filter=16743",
46
- "subject" => "[DD] PDTN!",
47
- "template" => "lib/messages/due_date_expired.erb"
44
+ Opts.new(
45
+ "from" => "fake@email.com",
46
+ "sql" => "filter=16743",
47
+ "subject" => "[DD] PDTN!",
48
+ "template" => "lib/messages/due_date_expired.erb"
49
+ )
48
50
  )
49
51
  assert_equal 2,
50
52
  Mail::TestMailer.deliveries
@@ -53,7 +55,7 @@ module Lazylead
53
55
  end
54
56
 
55
57
  test "configuration properties merged successfully" do
56
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
58
+ CLI::App.new(Log.new, NoSchedule.new).run(
57
59
  home: ".",
58
60
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
59
61
  vcs4sql: "upgrades/sqlite",
@@ -75,10 +77,12 @@ module Lazylead
75
77
  Task::AssigneeAlert.new.run(
76
78
  NoAuthJira.new("https://jira.spring.io"),
77
79
  Postman.new,
78
- "from" => "fake@email.com",
79
- "sql" => "key in ('STS-3599')",
80
- "subject" => "[DD] HMCHT!",
81
- "template" => "lib/messages/due_date_expired.erb"
80
+ Opts.new(
81
+ "from" => "fake@email.com",
82
+ "sql" => "key in ('STS-3599')",
83
+ "subject" => "[DD] HMCHT!",
84
+ "template" => "lib/messages/due_date_expired.erb"
85
+ )
82
86
  )
83
87
  assert_email "[DD] HMCHT!",
84
88
  %w[STS-3599 2013-11-08 Major Miles\ Parker Use JavaFX WebView]
@@ -89,12 +93,14 @@ module Lazylead
89
93
  Task::Alert.new.run(
90
94
  NoAuthJira.new("https://jira.spring.io"),
91
95
  Postman.new,
92
- "from" => "fake@email.com",
93
- "sql" => "key in ('STS-3599')",
94
- "subject" => "ALRT: Frozen",
95
- "template" => "lib/messages/due_date_expired.erb",
96
- "to" => "big.boss@example.com",
97
- "addressee" => "Boss"
96
+ Opts.new(
97
+ "from" => "fake@email.com",
98
+ "sql" => "key in ('STS-3599')",
99
+ "subject" => "ALRT: Frozen",
100
+ "template" => "lib/messages/due_date_expired.erb",
101
+ "to" => "big.boss@example.com",
102
+ "addressee" => "Boss"
103
+ )
98
104
  )
99
105
  assert_email "ALRT: Frozen",
100
106
  %w[Hi Boss STS-3599 2013-11-08 Major Miles\ Parker Use JavaFX WebView]
@@ -105,13 +111,15 @@ module Lazylead
105
111
  Task::Alert.new.run(
106
112
  NoAuthJira.new("https://jira.spring.io"),
107
113
  Postman.new,
108
- "from" => "fake@email.com",
109
- "sql" => "key in ('STS-3599')",
110
- "subject" => "CC: Watching",
111
- "template" => "lib/messages/due_date_expired.erb",
112
- "to" => "big.boss@example.com",
113
- "addressee" => "Boss",
114
- "cc" => "another.boss@example.com,mom@home.com"
114
+ Opts.new(
115
+ "from" => "fake@email.com",
116
+ "sql" => "key in ('STS-3599')",
117
+ "subject" => "CC: Watching",
118
+ "template" => "lib/messages/due_date_expired.erb",
119
+ "to" => "big.boss@example.com",
120
+ "addressee" => "Boss",
121
+ "cc" => "another.boss@example.com,mom@home.com"
122
+ )
115
123
  )
116
124
  assert_equal %w[another.boss@example.com mom@home.com],
117
125
  Mail::TestMailer.deliveries
@@ -124,10 +132,12 @@ module Lazylead
124
132
  Task::ReporterAlert.new.run(
125
133
  NoAuthJira.new("https://jira.spring.io"),
126
134
  Postman.new,
127
- "from" => "fake@email.com",
128
- "sql" => "filter=16743",
129
- "subject" => "DD Expired!",
130
- "template" => "lib/messages/due_date_expired.erb"
135
+ Opts.new(
136
+ "from" => "fake@email.com",
137
+ "sql" => "filter=16743",
138
+ "subject" => "DD Expired!",
139
+ "template" => "lib/messages/due_date_expired.erb"
140
+ )
131
141
  )
132
142
  assert_equal 2,
133
143
  Mail::TestMailer.deliveries