← Back to Upcase

Specs for routes with clearance constraints


(Daniel Nolan) #1

I have the following routes.

  constraints Clearance::Constraints::SignedOut.new do
    root to: 'homepage#show'
  end

  constraints Clearance::Constraints::SignedIn.new do
    root to: 'dashboards#show', as: :signed_in_root
  end

Before I added the constraints the app has a spec for homepage routes

require "spec_helper"

describe "routes for Homepage" do
  it "routes / to the homepage controller" do
    expect(get(root_path(as: @current_user))).to route_to("homepage#show")
  end
end

My question is:
Is it really necessary to test the root routes? If so how would I go about stubbing the signed_in? and signed_out? methods in a route spec?