For Documents, the 2 load ensuring checks are implement via the following:
In Concerns::LoadEnsuring
def ensure_loaded!
if locator = loaded_locator
find(*eval_locator(locator))
end
self
rescue Capybara::ElementNotFound => e
raise LoadingFailed, e.message
end
In Concerns::Visitable
def ensure_loaded!
unless self.class.can_load_from_current_url?
raise LoadingFailed, "#{self.class.name} cannot be loaded with url '#{current_url_without_params}'"
end
super
end
The Visitable method is called first. This method will fail immediately if the URL does match the path. Instead, this code should poll on the URL. This is necessary for JS redirects whereby JS code sets the window.location property.
For Documents, the 2 load ensuring checks are implement via the following:
In Concerns::LoadEnsuring
In Concerns::Visitable
The Visitable method is called first. This method will fail immediately if the URL does match the path. Instead, this code should poll on the URL. This is necessary for JS redirects whereby JS code sets the window.location property.