Files
ubicloud/spec/routes/runtime/spec_helper.rb
Jeremy Evans 60e129bd84 Fix the specs to avoid defining methods on Object
Defining methods inside RSpec.configure blocks still defines them on
Object.  Use config.include with a module to define these only in the
specs and not globally.

For matcher methods, define them in RSpec::Matchers::DSL::Matcher.
Change rubocop config to allow this inside of the RSpec.configure
blocks (technically, any constant inside any block).

Add an Object.method_added hook that raises an exception if defining
a method on object, other than Nokogiri, which is defined by the
nokogiri gem. This will result in the specs raising an error without
executing anything if you attempt to define a method on Object.
2025-05-03 03:33:24 +09:00

16 lines
352 B
Ruby

# frozen_string_literal: true
require_relative "../spec_helper"
RSpec.configure do |config|
config.before {
allow(Config).to receive(:clover_runtime_token_secret).and_return(Config.clover_session_secret)
}
config.include(Module.new do
def login_runtime(vm)
header "Authorization", "Bearer #{vm.runtime_token}"
end
end)
end