module RSpec::Testrail
Constants
- VERSION
Attributes
options[R]
Public Class Methods
client()
click to toggle source
# File lib/rspec/testrail.rb, line 21 def client @client ||= Client.new(@options[:url], @options[:user], @options[:password]) end
init(hash = {})
click to toggle source
# File lib/rspec/testrail.rb, line 9 def init(hash = {}) @options = { url: hash[:url], user: hash[:user], password: hash[:password], project_id: hash[:project_id], suite_id: hash[:suite_id], run_name: hash[:run_name], run_description: hash[:run_description] } end
process(example)
click to toggle source
# File lib/rspec/testrail.rb, line 25 def process(example) if example.exception status = 5 message = example.exception.message else status = 1 message = '' end client.send_post("add_result_for_case/#{testrun['id']}/#{example.metadata[:testrail_id]}", status_id: status, comment: message) end
reset()
click to toggle source
# File lib/rspec/testrail.rb, line 38 def reset @options = nil @client = nil @testrun = nil @testruns = nil end
Protected Class Methods
testrun()
click to toggle source
# File lib/rspec/testrail.rb, line 47 def testrun @testrun ||= if testruns.empty? client.send_post("add_run/#{@options[:project_id]}", suite_id: @options[:suite_id], name: @options[:run_name], description: @options[:run_description]) else client.send_post("update_run/#{testruns[0]['id']}", description: @options[:run_description]) end end
testruns()
click to toggle source
# File lib/rspec/testrail.rb, line 60 def testruns @testruns ||= client.send_get("get_runs/#{@options[:project_id]}&#{URI.encode_www_form([["suite_id", @options[:suite_id]]])}") .fetch("runs", []) .select do |run| run['name'].include?(@options[:run_name]) end end