debian-mirror-gitlab/spec/support/helpers/wiki_helpers.rb

29 lines
736 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-12-13 13:39:08 +05:30
module WikiHelpers
extend self
2020-11-24 15:15:51 +05:30
def stub_group_wikis(enabled)
stub_feature_flags(group_wikis: enabled)
stub_licensed_features(group_wikis: enabled)
end
2020-04-08 14:13:33 +05:30
def wait_for_svg_to_be_loaded(example = nil)
# Ensure the SVG is loaded first before clicking the button
find('.svg-content .js-lazy-loaded') if example.nil? || example.metadata.key?(:js)
end
2021-01-03 14:25:43 +05:30
def upload_file_to_wiki(wiki, user, file_name)
params = {
2018-12-13 13:39:08 +05:30
file_name: file_name,
file_content: File.read(expand_fixture_path(file_name))
}
2020-05-24 23:13:21 +05:30
::Wikis::CreateAttachmentService.new(
2021-01-03 14:25:43 +05:30
container: wiki.container,
2020-05-24 23:13:21 +05:30
current_user: user,
2021-01-03 14:25:43 +05:30
params: params
).execute.dig(:result, :file_path)
2018-12-13 13:39:08 +05:30
end
end