class GemHadar
def assert_valid_link(name, orig_url)
-
(ArgumentError)
- if the final response is not an HTTP OK status after
Returns:
-
(String)
- the original URL if validation succeeds
Parameters:
-
orig_url
(String
) -- the URL to validate -
name
(String
) -- the name associated with the link being validated
def assert_valid_link(name, orig_url) developing and return orig_url url = orig_url begin response = Net::HTTP.get_response(URI.parse(url)) url = response['location'] end while response.is_a?(Net::HTTPRedirection) response.is_a?(Net::HTTPOK) or fail "#{orig_url.inspect} for #{name} has to be a valid link" orig_url end