Class: ProbeDockRSpec::MetaParser

Inherits:
Object
  • Object
show all
Defined in:
lib/probe_dock_rspec/meta_parser.rb

Class Method Summary collapse

Class Method Details

.parse(example, groups = []) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/probe_dock_rspec/meta_parser.rb', line 6

def self.parse example, groups = []

  options = {}

  %i(key category tags tickets data active).each do |attr|
    options[attr] = send("extract_#{attr}", example, groups)
  end

  name_parts = extract_name_parts(example, groups)
  options[:name] = name_parts.join(' ')
  options[:fingerprint] = Digest::SHA1.hexdigest(name_parts.join('|||'))

  data = options[:data]
   = example.

  # TODO: remove once Probe Dock has been migrated to use fingerprints
  data['fingerprint'] = options[:fingerprint]

  data['file.path'] = [:file_path].to_s.sub(/^\.\//, '') if [:file_path]
  data['file.line'] = [:line_number] if [:line_number]

  options
end