Class: SuitesResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/berl/suites_resolver.rb

Overview

Service to resolve suites

Instance Method Summary collapse

Constructor Details

#initialize(suites_path) ⇒ SuitesResolver

Returns a new instance of SuitesResolver.



5
6
7
# File 'lib/berl/suites_resolver.rb', line 5

def initialize(suites_path)
  @suites_path = suites_path
end

Instance Method Details

#resolve_suitesObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/berl/suites_resolver.rb', line 9

def resolve_suites
  files = Dir.glob("#{Dir.pwd}/#{@suites_path}/**/*.{yml,yaml}")
  suites = []

  files.each do |path|
    content = IO.read(path)
    match = content.match(/\s+((api|ui|domain)[^:]+)/)
    suite = match.to_s.strip

    suites.push(suite) if suite.length.positive?
  end

  suites
end