Class: Lazylead::Servers
- Inherits:
-
Requirement
- Object
- Requirement
- Lazylead::Servers
- Defined in:
- lib/lazylead/task/accuracy/servers.rb
Overview
Check that ticket has expected links to failed entities on dedicated
servers.
Instance Attribute Summary
Attributes inherited from Requirement
Instance Method Summary collapse
-
#initialize(score: 2, envs: [], desc: "Internal reproducing results") ⇒ Servers
constructor
A new instance of Servers.
-
#match?(url) ⇒ Boolean
Ensure that particular url matches expected servers urls.
- #passed(issue) ⇒ Object
-
#url?(text) ⇒ Boolean
Ensure that particular text contains web url.
Methods inherited from Requirement
Constructor Details
#initialize(score: 2, envs: [], desc: "Internal reproducing results") ⇒ Servers
Returns a new instance of Servers.
34 35 36 37 |
# File 'lib/lazylead/task/accuracy/servers.rb', line 34 def initialize(score: 2, envs: [], desc: "Internal reproducing results") super desc, score, "Description/Environment" @envs = envs end |
Instance Method Details
#match?(url) ⇒ Boolean
Ensure that particular url matches expected servers urls
55 56 57 |
# File 'lib/lazylead/task/accuracy/servers.rb', line 55 def match?(url) @envs.any? { |e| url.match? e } end |
#passed(issue) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/lazylead/task/accuracy/servers.rb', line 39 def passed(issue) return true if @envs.empty? "#{issue['environment']}\n#{issue.description}".split("\n") .reject(&:blank?) .map(&:strip) .flat_map { |l| l.split.map(&:strip) } .select { |u| url?(u) } .any? { |u| match?(u) } end |
#url?(text) ⇒ Boolean
Ensure that particular text contains web url
50 51 52 |
# File 'lib/lazylead/task/accuracy/servers.rb', line 50 def url?(text) text.include?("http://") || text.include?("https://") end |