Files
discourse/spec/support/onebox_helpers.rb
Loïc Guitaut 4f82ceaf39 DEV: Introduce core features system specs for plugins
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
```
2025-03-27 12:12:01 +01:00

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