docbrown/spec/support/embeds_helpers.rb
Arit Amana 34bfc491b0
Check validity of embed URLs (#16704)
* start link validation check

* keep PRs small

* rearrange check flow

* need a change to switch accounts

* Rescue from SocketError to surface a better error message

* some updates

* handle 301s

* address Travis failures

* implement request stub

* add needed unified-embed tag spec

* add needed unified-embed tag spec

* nudge Travis

* Address PR review comments

* special-case displaying "base"

* undo change to errors.add

* nudge Travis

* more succinct code

Co-authored-by: aritmock <aritmock@example.com>
Co-authored-by: Dwight Scott <dwight@forem.com>
2022-03-10 13:18:59 -05:00

11 lines
269 B
Ruby

module EmbedsHelpers
def stub_request_head(url, status_code = 200)
stub_request(:head, url)
.with(
headers: {
Accept: "*/*",
"User-Agent": "Ruby"
},
).to_return(status: status_code, body: "", headers: {})
end
end