lazylead 0.9.2 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/Rakefile +1 -2
  4. data/lazylead.gemspec +14 -14
  5. data/lib/lazylead/confluence.rb +1 -2
  6. data/lib/lazylead/os.rb +55 -0
  7. data/lib/lazylead/task/accuracy/accuracy.rb +2 -3
  8. data/lib/lazylead/task/accuracy/attachment.rb +1 -0
  9. data/lib/lazylead/task/accuracy/environment.rb +3 -8
  10. data/lib/lazylead/task/accuracy/logs_link.rb +55 -0
  11. data/lib/lazylead/task/accuracy/records.rb +1 -1
  12. data/lib/lazylead/task/accuracy/required.rb +42 -0
  13. data/lib/lazylead/task/accuracy/screenshots.rb +5 -6
  14. data/lib/lazylead/task/accuracy/servers.rb +7 -7
  15. data/lib/lazylead/task/accuracy/testcase.rb +27 -20
  16. data/lib/lazylead/task/fix_version.rb +5 -8
  17. data/lib/lazylead/task/loading.rb +2 -2
  18. data/lib/lazylead/task/svn/diff.rb +9 -9
  19. data/lib/lazylead/task/svn/grep.rb +8 -71
  20. data/lib/lazylead/task/svn/svn.rb +107 -0
  21. data/lib/lazylead/task/svn/touch.rb +5 -7
  22. data/lib/lazylead/version.rb +1 -1
  23. data/lib/messages/illegal_assignee_change.erb +1 -2
  24. data/lib/messages/loading.erb +1 -1
  25. data/lib/messages/svn_diff.erb +29 -29
  26. data/lib/messages/svn_diff_attachment.erb +5 -7
  27. data/lib/messages/svn_grep.erb +34 -32
  28. data/readme.md +4 -3
  29. data/test/lazylead/system/jira_test.rb +8 -0
  30. data/test/lazylead/task/accuracy/accuracy_test.rb +1 -1
  31. data/test/lazylead/task/accuracy/logs_link_test.rb +50 -0
  32. data/test/lazylead/task/accuracy/onlyll_test.rb +1 -1
  33. data/test/lazylead/task/accuracy/screenshots_test.rb +2 -4
  34. data/test/lazylead/task/accuracy/testcase_test.rb +16 -0
  35. data/test/lazylead/task/alert/alertif_test.rb +2 -1
  36. data/test/lazylead/task/assignment_test.rb +2 -1
  37. data/test/lazylead/task/created_recently_test.rb +2 -1
  38. data/test/lazylead/task/duedate_test.rb +2 -2
  39. data/test/lazylead/task/fix_version_test.rb +2 -1
  40. data/test/lazylead/task/loading_test.rb +5 -2
  41. data/test/lazylead/task/micromanager_test.rb +1 -1
  42. data/test/lazylead/task/missing_comment_test.rb +1 -1
  43. data/test/lazylead/task/svn/diff_test.rb +1 -1
  44. data/test/lazylead/task/svn/grep_test.rb +2 -1
  45. data/test/test.rb +4 -3
  46. metadata +33 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2bb060ea62241a94384885e9d05b876f451e60051a89bc4ee7d8e3f84680d4a
4
- data.tar.gz: 9c5906d631101d1bff071934fe0c52a0b9e1d1c9f655fdb8c3f958ba168639f0
3
+ metadata.gz: 1fa41cd073bf1df41fee51ab890e6fd72a379bc0f4fd3d6db118194bbbcad85f
4
+ data.tar.gz: 310978fbc087cb95064a28c86e48f79cd03928217f03701df7976a74d8b0442b
5
5
  SHA512:
6
- metadata.gz: 3a09897c26cffbce936e449973c6ddd115374a37fde1d5d8892832615b03410cdff4b6bc642923d373b15402ad29283719b90f34899b91a769d07994df20f7cb
7
- data.tar.gz: 782c925452d6664542d3951bbf7ddde8e278211386c39b9593c94d2e54087789fc972db5f38ee8aaa0e6c4545732e6f36739b821ccaef20fe3b2f396a475c96f
6
+ metadata.gz: bacaf9e2ba2a774e979e4957ca8e18623188a419b0a9f5363ea237692dc9977376e78411bbe0fcf0f575a8ac80352258aaa35236554c824302ffa99d4994ebf3
7
+ data.tar.gz: 7df938335a3179983280f254194cb9f1e8e6b3b0de2cf890ed97a38b7056d5aa0a3ec073ec0a3e1c47a5480c7f3f003be1f07a328e5da90a5f4f278e8c5be2ba
data/.rubocop.yml CHANGED
@@ -42,7 +42,7 @@ Metrics/MethodLength:
42
42
  - "test/**/*"
43
43
 
44
44
  Metrics/ParameterLists:
45
- Max: 3
45
+ Max: 4
46
46
 
47
47
  Layout/HashAlignment:
48
48
  EnforcedColonStyle:
data/Rakefile CHANGED
@@ -114,8 +114,7 @@ task :sqlint do
114
114
  if total.positive?
115
115
  abort "#{total.colorize(:red)} SQL violations found."
116
116
  else
117
- puts "#{src.size} files inspected, #{'no offenses'.colorize(:green)} " \
118
- "detected"
117
+ puts "#{src.size} files inspected, #{'no offenses'.colorize(:green)} detected"
119
118
  end
120
119
  end
121
120
 
data/lazylead.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.rubygems_version = "2.2"
33
33
  s.required_ruby_version = ">=2.6.5"
34
34
  s.name = "lazylead"
35
- s.version = "0.9.2"
35
+ s.version = "0.10.2"
36
36
  s.license = "MIT"
37
37
  s.summary = "Eliminate the annoying work within bug-trackers."
38
38
  s.description = "Ticketing systems (Github, Jira, etc.) are strongly
@@ -45,7 +45,7 @@ tasks instead of solving technical problems."
45
45
  s.authors = ["Yurii Dubinka"]
46
46
  s.email = "yurii.dubinka@gmail.com"
47
47
  s.homepage = "http://github.com/dgroup/lazylead"
48
- s.post_install_message = "Thanks for installing Lazylead v0.9.2!
48
+ s.post_install_message = "Thanks for installing Lazylead v0.10.2!
49
49
  Read our blog posts: https://lazylead.org
50
50
  Stay in touch with the community in Telegram: https://t.me/lazylead
51
51
  Follow us on Twitter: https://twitter.com/lazylead
@@ -58,7 +58,7 @@ tasks instead of solving technical problems."
58
58
  s.add_runtime_dependency "activerecord", "6.1.3"
59
59
  s.add_runtime_dependency "backtrace", "0.3"
60
60
  s.add_runtime_dependency "colorize", "0.8.1"
61
- s.add_runtime_dependency "faraday", "1.4.1"
61
+ s.add_runtime_dependency "faraday", "1.5.1"
62
62
  s.add_runtime_dependency "get_process_mem", "0.2.7"
63
63
  s.add_runtime_dependency "inifile", "3.0.0"
64
64
  s.add_runtime_dependency "jira-ruby", "2.1.5"
@@ -69,9 +69,9 @@ tasks instead of solving technical problems."
69
69
  s.add_runtime_dependency "openssl", "2.1.2"
70
70
  s.add_runtime_dependency "railties", "6.1.3"
71
71
  s.add_runtime_dependency "require_all", "3.0.0"
72
- s.add_runtime_dependency "rubyzip", "2.3.0"
73
- s.add_runtime_dependency "rufus-scheduler", "3.7.0"
74
- s.add_runtime_dependency "slop", "4.8.2"
72
+ s.add_runtime_dependency "rubyzip", "2.3.2"
73
+ s.add_runtime_dependency "rufus-scheduler", "3.8.0"
74
+ s.add_runtime_dependency "slop", "4.9.1"
75
75
  s.add_runtime_dependency "sqlite3", "1.4.2"
76
76
  s.add_runtime_dependency "tempfile", "0.1.1"
77
77
  s.add_runtime_dependency "tilt", "2.0.10"
@@ -80,21 +80,21 @@ tasks instead of solving technical problems."
80
80
  s.add_runtime_dependency "vcs4sql", "0.1.1"
81
81
  s.add_runtime_dependency "viewpoint", "1.1.1"
82
82
  s.add_development_dependency "codecov", "0.5.2"
83
- s.add_development_dependency "guard", "2.16.2"
83
+ s.add_development_dependency "guard", "2.18.0"
84
84
  s.add_development_dependency "guard-minitest", "2.4.6"
85
85
  s.add_development_dependency "minitest", "5.14.4"
86
86
  s.add_development_dependency "minitest-fail-fast", "0.1.0"
87
87
  s.add_development_dependency "minitest-hooks", "1.5.0"
88
88
  s.add_development_dependency "minitest-reporters", "1.4.3"
89
89
  s.add_development_dependency "net-ping", "2.0.8"
90
- s.add_development_dependency "rake", "13.0.3"
90
+ s.add_development_dependency "rake", "13.0.6"
91
91
  s.add_development_dependency "random-port", "0.5.1"
92
- s.add_development_dependency "rdoc", "6.3.1"
93
- s.add_development_dependency "rubocop", "1.13.0"
94
- s.add_development_dependency "rubocop-minitest", "0.12.1"
95
- s.add_development_dependency "rubocop-performance", "1.11.1"
96
- s.add_development_dependency "rubocop-rake", "0.5.1"
97
- s.add_development_dependency "rubocop-rspec", "2.3.0"
92
+ s.add_development_dependency "rdoc", "6.3.2"
93
+ s.add_development_dependency "rubocop", "1.18.3"
94
+ s.add_development_dependency "rubocop-minitest", "0.14.0"
95
+ s.add_development_dependency "rubocop-performance", "1.11.4"
96
+ s.add_development_dependency "rubocop-rake", "0.6.0"
97
+ s.add_development_dependency "rubocop-rspec", "2.4.0"
98
98
  s.add_development_dependency "sqlint", "0.2.0"
99
99
  s.add_development_dependency "tempfile", "0.1.1"
100
100
  s.add_development_dependency "xcop", "0.6.2"
@@ -76,8 +76,7 @@ module Lazylead
76
76
  return "" if resp.blank?
77
77
  pages = JSON.parse(resp)
78
78
  return "" if pages["results"].empty?
79
- "#{@conf.url}/pages/viewpage.action?"\
80
- "pageId=#{pages['results'].first['id']}"
79
+ "#{@conf.url}/pages/viewpage.action?pageId=#{pages['results'].first['id']}"
81
80
  end
82
81
  end
83
82
 
@@ -0,0 +1,55 @@
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
+ module Lazylead
26
+ #
27
+ # Represents a native, operation system.
28
+ #
29
+ # Author:: Yurii Dubinka (yurii.dubinka@gmail.com)
30
+ # Copyright:: Copyright (c) 2019-2020 Yurii Dubinka
31
+ # License:: MIT
32
+ class OS
33
+ #
34
+ # Run OS-oriented command
35
+ # @param cmd
36
+ # The command could be a single string or array of strings.
37
+ # Examples Final command to OS
38
+ # run("ls") "ls" => stdout
39
+ # run("ls", "-lah") "ls -lah" => stdout
40
+ # run() N/A => ""
41
+ # run("ls", nil, "-lah") N/A => ""
42
+ # run("ls", "", "-lah") "ls -lah" => stdout
43
+ #
44
+ # @return stdout
45
+ # Please note, that this is not a raw stdout.
46
+ # The output will be modified by String#scrub! in order to avoid invalid byte sequence
47
+ # in UTF-8 (https://stackoverflow.com/a/24037885/6916890).
48
+ def run(*cmd)
49
+ return "" if cmd.empty? || cmd.any?(&:nil?)
50
+ todo = cmd
51
+ todo = [cmd.first] if cmd.size == 1
52
+ `#{todo.join(" ")}`.scrub!
53
+ end
54
+ end
55
+ end
@@ -86,7 +86,7 @@ module Lazylead
86
86
  "Hi [~#{reporter}],",
87
87
  "",
88
88
  "The triage accuracy is '{color:#{color}}#{@score}{color}'" \
89
- " (~{color:#{color}}#{@accuracy}%{color}), here are the reasons why:",
89
+ " (~{color:#{color}}#{@accuracy}%{color}), here are the reasons why:",
90
90
  "|| Ticket requirement || Status || Field ||"
91
91
  ]
92
92
  @opts[:rules].each do |r|
@@ -94,8 +94,7 @@ module Lazylead
94
94
  end
95
95
  comment << docs_link
96
96
  comment << ""
97
- comment << "Posted by [lazylead v#{Lazylead::VERSION}|" \
98
- "https://bit.ly/2NjdndS]."
97
+ comment << "Posted by [lazylead v#{Lazylead::VERSION}|https://bit.ly/2NjdndS]."
99
98
  comment.join("\r\n")
100
99
  end
101
100
 
@@ -28,6 +28,7 @@ module Lazylead
28
28
  # Check that ticket has an attachment.
29
29
  class Attachment < Lazylead::Requirement
30
30
  def passed(issue)
31
+ return false if issue.nil? || issue.attachments.nil?
31
32
  issue.attachments.any? { |a| matches?(a) }
32
33
  end
33
34
 
@@ -22,18 +22,13 @@
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_relative "requirement"
25
+ require_relative "required"
26
26
 
27
27
  module Lazylead
28
28
  # A requirement that Jira field "Environment" provided by the reporter.
29
- class Environment < Requirement
29
+ class Environment < Lazylead::Required
30
30
  def initialize(score = 0.5)
31
- super "Environment details (URL, patches)", score, "Environment"
32
- end
33
-
34
- # @return true if an issue has non-empty "Environment" field
35
- def passed(issue)
36
- non_blank? issue, "environment"
31
+ super "Environment details (URL, patches)", score, "Environment", "environment"
37
32
  end
38
33
  end
39
34
  end
@@ -0,0 +1,55 @@
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 "logs"
26
+ require_relative "attachment"
27
+
28
+ module Lazylead
29
+ # Check that ticket has link/reference to log record(s) in another system like ELK, GrayLog, etc.
30
+ # or attachment with plain log file
31
+ class LogsLink < Lazylead::Logs
32
+ def initialize(link)
33
+ super
34
+ @link = link
35
+ end
36
+
37
+ def passed(issue)
38
+ return false if @link.nil? || (@link.is_a?(Array) && @link.empty?)
39
+ super(issue) || link?(issue)
40
+ end
41
+
42
+ # Ensure that ticket has a link to external logs system like ELK, GrayLog, etc.
43
+ def link?(issue)
44
+ return false if issue.description.nil?
45
+ issue.description
46
+ .split("\n")
47
+ .reject(&:blank?)
48
+ .flat_map(&:split)
49
+ .reject(&:blank?)
50
+ .any? do |word|
51
+ @link.is_a?(Array) ? @link.any? { |l| word.start_with? l } : word.start_with?(@link)
52
+ end
53
+ end
54
+ end
55
+ end
@@ -28,7 +28,7 @@ module Lazylead
28
28
  # Check that ticket has video record(s) with reproducing results.
29
29
  class Records < Lazylead::Attachment
30
30
  def initialize(ext = [])
31
- super("Recorded internal reproducing results", 5, "Attachments")
31
+ super("Internal reproducing results (video)", 5, "Attachments")
32
32
  @ext = ext
33
33
  return unless @ext.empty?
34
34
  @ext = %w[.webm .mkv .flv .flv .vob .ogv .ogg .drc .gif .gifv .mng .avi
@@ -0,0 +1,42 @@
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 "requirement"
26
+
27
+ module Lazylead
28
+ #
29
+ # Check that ticket has mandatory non-blank field(s).
30
+ #
31
+ class Required < Lazylead::Requirement
32
+ def initialize(desc, score, msg, *fields)
33
+ super desc, score, msg
34
+ @fields = fields
35
+ end
36
+
37
+ def passed(issue)
38
+ return false if @fields.nil? || @fields.empty?
39
+ @fields.all? { |f| non_blank?(issue, f) }
40
+ end
41
+ end
42
+ end
@@ -35,15 +35,14 @@ module Lazylead
35
35
  class Screenshots < Lazylead::Requirement
36
36
  # @param minimum The number of expected screenshots
37
37
  def initialize(minimum: 1, score: 2, ext: %w[.jpg .jpeg .exif .tiff .tff .bmp .png .svg])
38
- super "Screenshots", score, "Description,Attachments"
38
+ super "Internal reproducing results (screenshots)", score, "Description,Attachments"
39
39
  @minimum = minimum
40
40
  @ext = ext
41
41
  end
42
42
 
43
43
  def passed(issue)
44
44
  return false if issue.attachments.nil? || blank?(issue, "description")
45
- ref = references(issue)
46
- ref.size < @minimum ? false : ref.all? { |r| pictures(issue).any? { |file| r.include? file } }
45
+ references(issue).count { |r| pictures(issue).any? { |file| r.include? file } } >= @minimum
47
46
  end
48
47
 
49
48
  # Detect all references in ticket description to attachments (including web links).
@@ -57,9 +56,9 @@ module Lazylead
57
56
 
58
57
  # Detect all pictures in ticket attachments and returns an array with file names.
59
58
  def pictures(issue)
60
- @pictures ||= issue.attachments
61
- .select { |a| @ext.include? File.extname(a.filename).downcase }
62
- .map(&:filename)
59
+ issue.attachments
60
+ .select { |a| @ext.include? File.extname(a.filename).downcase }
61
+ .map(&:filename)
63
62
  end
64
63
  end
65
64
  end
@@ -32,18 +32,18 @@ module Lazylead
32
32
  # @param envs regexp expressions to match servers in description.
33
33
  #
34
34
  def initialize(score: 2, envs: [], desc: "Internal reproducing results")
35
- super desc, score, "Description/Environment"
35
+ super desc, score, "Description"
36
36
  @envs = envs
37
37
  end
38
38
 
39
39
  def passed(issue)
40
40
  return true if @envs.empty?
41
- "#{issue['environment']}\n#{issue.description}".split("\n")
42
- .reject(&:blank?)
43
- .map(&:strip)
44
- .flat_map { |l| l.split.map(&:strip) }
45
- .select { |u| url?(u) }
46
- .any? { |u| match?(u) }
41
+ issue.description.split("\n")
42
+ .reject(&:blank?)
43
+ .map(&:strip)
44
+ .flat_map { |l| l.split.map(&:strip) }
45
+ .select { |u| url?(u) }
46
+ .any? { |u| match?(u) }
47
47
  end
48
48
 
49
49
  # Ensure that particular text contains web url
@@ -37,11 +37,11 @@ module Lazylead
37
37
  def passed(issue)
38
38
  return false if issue.description.nil?
39
39
  @tc = @ar = @er = -1
40
- issue.description.split("\n").reject(&:blank?).each_with_index do |l, i|
41
- line = escape l.downcase.gsub(/(\s+|\*|\+)/, "")
42
- detect_tc line, i
43
- detect_ar line, i
44
- detect_er line, i
40
+ issue.description.split("\n").reject(&:blank?).map(&:downcase).each_with_index do |l, i|
41
+ line = escape l.gsub(/(\s+|\*|\+)/, "")
42
+ detect_tc i, l, line
43
+ detect_ar i, l, line
44
+ detect_er i, l, line
45
45
  break if with_tc_ar_er?
46
46
  end
47
47
  with_tc_ar_er?
@@ -63,30 +63,37 @@ module Lazylead
63
63
  end
64
64
 
65
65
  # Detect index of line with test case
66
- def detect_tc(line, index)
66
+ # @param index The line number in description
67
+ # @param src The whole line in lower case from description
68
+ # @param strip The escaped line in lower case from description without special symbol(s)
69
+ def detect_tc(index, src, strip)
67
70
  return unless @tc.negative?
68
- @tc = index if eql? line, %w[testcase: tc: teststeps: teststeps steps: tcsteps: tc testcases
69
- steps usecase]
71
+ keywords = %w[testcase: tc: teststeps: teststeps steps: tcsteps: tc testcases steps usecase
72
+ pre-requisitesandsteps:]
73
+ @tc = index if keywords.any? { |k| strip.eql? k }
74
+ @tc = index if keywords.any? { |k| src.include? k }
70
75
  end
71
76
 
72
77
  # Detect index of line with actual result
73
- def detect_ar(line, index)
78
+ # @param index The line number in description
79
+ # @param src The whole line in lower case from description
80
+ # @param strip The escaped line in lower case from description without special symbol(s)
81
+ def detect_ar(index, src, strip)
74
82
  return unless @ar.negative? && index > @tc
75
- @ar = index if starts? line, %w[ar: actualresult: ar= [ar] actualresult]
83
+ keywords = %w[ar: actualresult: ar= [ar] actualresult]
84
+ @ar = index if keywords.any? { |k| strip.start_with? k }
85
+ @ar = index if keywords.any? { |k| src.include? k }
76
86
  end
77
87
 
78
88
  # Detect index of line with expected result
79
- def detect_er(line, index)
89
+ # @param index The line number in description
90
+ # @param src The whole line in lower case from description
91
+ # @param strip The escaped line in lower case from description without special symbol(s)
92
+ def detect_er(index, src, strip)
80
93
  return unless @er.negative? && index > @tc
81
- @er = index if starts? line, %w[er: expectedresult: er= [er] expectedresult]
82
- end
83
-
84
- def starts?(line, text)
85
- text.any? { |t| line.start_with? t }
86
- end
87
-
88
- def eql?(line, text)
89
- text.any? { |t| t.eql? line }
94
+ keywords = %w[er: expectedresult: er= [er] expectedresult]
95
+ @er = index if keywords.any? { |k| strip.start_with? k }
96
+ @er = index if keywords.any? { |k| src.include? k }
90
97
  end
91
98
  end
92
99
  end