我正在尝试执行一些涉及发送REST调用的ruby脚本,但是在注销时由于以下错误而失败。
An error occurred in an `after(:context)` hook.
Failure/Error: $root_curl_request.logout
NoMethodError:
undefined method `logout' for nil:NilClass
# ./lib/common/rest_spec_helper.rb:112:in `block (2 levels) in <top (required)>'
我从rest_spec_helper.rb:112下面获得了代码块
require_relative 'rest_request'
require_relative 'curl_request'
$rest_api = RestRequest.new
RSpec.configure do |config|
config.before :all do
$oracle_conn = OracleConnection.new
ncs_server = $testbed.get_ncs_server
root_password = ncs_server["application_root_password"] || "Public123"
$root_curl_request = CurlRequest.new("root",root_password) unless ncs_server["application_user_name"]=="root"
rest_add_user
$curl_request = CurlRequest.new
$rest_api = RestRequest.new
$sapro_server = SaproServer.new if $testbed.get_ncs_server["sapro_server_ip"]
time = Time.now.strftime("%d%m%Y%H%M%S")
file="logs/auto#{time}.log"
$log=Logger.new(file)
$debug=true
end
config.after :all do
$debug = true
$rest_api.logout_curl
$curl_request.logout
$root_curl_request.logout // this is the 112 line
end
end
请让我知道如何纠正此错误。