class QaAtMigration::TestFile

Constants

DEFAULT_STATUS

Public Class Methods

new(path) click to toggle source
# File lib/qa_at_migration/test_file.rb, line 5
def initialize(path)
  @path = path
end

Public Instance Methods

content() click to toggle source
# File lib/qa_at_migration/test_file.rb, line 9
def content
  [
    title,
    description,
    preconditions,
    steps,
    status
  ]
end

Private Instance Methods

description() click to toggle source
# File lib/qa_at_migration/test_file.rb, line 29
def description
  info[1].chomp
end
extract_steps(part) click to toggle source
# File lib/qa_at_migration/test_file.rb, line 57
def extract_steps(part)
  part.shift
  part.join('')
end
info() click to toggle source
# File lib/qa_at_migration/test_file.rb, line 21
def info
  parts.first
end
lines() click to toggle source
# File lib/qa_at_migration/test_file.rb, line 53
def lines
  text.lines.reject { |line| line == "\n" || line.start_with?('<!---') }
end
parts() click to toggle source
# File lib/qa_at_migration/test_file.rb, line 49
def parts
  @parts ||= lines.slice_before(/^##? /).to_a
end
preconditions() click to toggle source
# File lib/qa_at_migration/test_file.rb, line 33
def preconditions
  extract_steps(parts[1]) unless parts.length != 3
end
status() click to toggle source
# File lib/qa_at_migration/test_file.rb, line 41
def status
  DEFAULT_STATUS
end
steps() click to toggle source
# File lib/qa_at_migration/test_file.rb, line 37
def steps
  extract_steps(parts.last)
end
text() click to toggle source
# File lib/qa_at_migration/test_file.rb, line 45
def text
  File.read(@path)
end
title() click to toggle source
# File lib/qa_at_migration/test_file.rb, line 25
def title
  info[0].chomp.tap { |t| t[0..1] = '' }
end