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



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

def export_pr_data(pr)
    export_pr_variables(pr)
    export_pr_data_to_simple_file(pr)
    export_pr_data_to_json_file(pr)
end

#pr_test(pr) ⇒ Object

this will clone the repo and execute the tests



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

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

#run_scriptObject

run validation script for validating the PR.



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

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