Commit 4c1f7449 authored by Mark Chao's avatar Mark Chao Committed by Stan Hu

Convenience metadata to stub SaaS/gitlab.com

Works with let_it_be which is done before_all,
where method stubbing is not allowed.
parent 6489ff92
# frozen_string_literal: true
RSpec.configure do |config|
config.before(:context, :saas) do
# Ensure Gitlab.com? returns true during context.
# This is needed for let_it_be which is shared across examples,
# therefore the value must be changed in before_all,
# but RSpec prevent stubbing method calls in before_all,
# therefore we have to resort to temporarily swap url value.
@_original_gitlab_url = Gitlab.config.gitlab['url']
Gitlab.config.gitlab['url'] = Gitlab::Saas.com_url
end
config.after(:context, :saas) do
# Swap back original value
Gitlab.config.gitlab['url'] = @_original_gitlab_url
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment