Class: TestExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/gitarro/backend.rb

Overview

This is a private class, which has the task to execute/run tests called by Backend

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ TestExecutor

Returns a new instance of TestExecutor.



78
79
80
81
82
83
84
85
86
# File 'lib/gitarro/backend.rb', line 78

def initialize(options)
  @options = options
  @options.each do |key, value|
    instance_variable_set("@#{key}", value)
    self.class.send(:attr_accessor, key)
  end
  Octokit.auto_paginate = true
  @client = Octokit::Client.new(netrc: true)
end

Instance Method Details

#export_pr_data(pr) ⇒ Object



102
103
104
105
# File 'lib/gitarro/backend.rb', line 102

def export_pr_data(pr)
    export_pr_data_to_simple_file(pr)
    export_pr_data_to_file(pr)
end

#pr_test(pr) ⇒ Object

this will clone the repo and execute the tests



89
90
91
92
93
94
# File 'lib/gitarro/backend.rb', line 89

def pr_test(pr)
  clone_repo(@noshallow, pr)
  # do valid tests and store the result
  test_status = run_script
  test_status
end

#run_scriptObject

run validation script for validating the PR.



97
98
99
100
# File 'lib/gitarro/backend.rb', line 97

def run_script
  puts `#{@test_file}`
  $CHILD_STATUS.exitstatus.nonzero? ? 'failure' : 'success'
end