Class: Lazylead::Servers

Inherits:
Requirement show all
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

#desc, #field, #score

Instance Method Summary collapse

Methods inherited from Requirement

#blank?, #non_blank?

Constructor Details

#initialize(score: 2, envs: [], desc: "Internal reproducing results") ⇒ Servers

Returns a new instance of Servers.

Parameters:

  • envs (defaults to: [])

    regexp expressions to match servers in description.



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

#passed(issue) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/lazylead/task/accuracy/servers.rb', line 39

def passed(issue)
  return true if @envs.empty?
  lines = issue["environment"].to_s + "\n" + issue.description
  lines.split("\n")
       .reject(&:blank?)
       .map(&:strip)
       .flat_map { |l| l.split(" ").map(&:strip) }
       .select { |w| w.include?("http://") || w.include?("https://") }
       .any? { |u| @envs.any? { |e| u.match? e } }
end