Class: Brut::SpecSupport::Matchers::HaveRedirectedTo

Inherits:
Object
  • Object
show all
Defined in:
lib/brut/spec_support/matchers/have_redirected_to.rb

Overview

Used on handler specs to check that a response has redirected to a page or URI. Can also be used with ComponentSupport#generate_result to check that a Page's FrontEnd::Page#before_generate method did what you expect

Examples:

result = handler.handle
expect(result).to have_redirected_to(HomePage)

with parameters

result = handler.handle
expect(result).to have_redirected_to(WidgetsByWidgetIdPage, id: widget.id)

arbitrary URI

result = handler.handle
expect(result).to have_redirected_to("http://kagi.com")

testing a before_generate method

result = generate_result(page)
expect(result).to have_redirected_to(LoginPage)