mirror of
https://github.com/discourse/discourse.git
synced 2025-06-16 00:34:06 +08:00

This patch adds a new shared example to be used as a smoke test in plugins and themes. A `skip_examples` argument is available to easily opt-out from a category of tests. Example: ```rb RSpec.describe "Testing core features", type: :system do it_behaves_like "having working core features", skip_examples: %i[search login] end ```
14 lines
394 B
Ruby
14 lines
394 B
Ruby
# frozen_string_literal: true
|
|
|
|
module OneboxHelpers
|
|
def onebox_response(file)
|
|
file = File.join("spec", "fixtures", "onebox", "#{file}.response")
|
|
File.exist?(file) ? File.read(file) : ""
|
|
end
|
|
|
|
def inspect_html_fragment(raw_fragment, tag_name, attribute = "src")
|
|
preview = Nokogiri::HTML::DocumentFragment.parse(raw_fragment)
|
|
preview.css(tag_name).first[attribute]
|
|
end
|
|
end
|