Updated

spec/routing / domain_constraints_spec.rb

B
43 lines of codes
0 methods
N/A complexity/method
2 churn
57.8 complexity
0 duplications
require 'rails_helper' RSpec.describe "domain constraints", type: :routes do context "when on the public domain" do context "and making a request for a public path" do it "is routable" do expect(get("/petitions")).to route_to("petitions#index") end end context "and making a request for an admin path" do it "is not routeable" do expect(get("/admin/login")).not_to be_routable end end context "and making a request for the root path" do it "is routable" do expect(get("/")).to route_to("pages#index") end end end context "when on the moderate subdomain", admin: true do context "and making a request for a public path" do it "is not routeable" do expect(get("/petitions")).not_to be_routable end end context "and making a request for an admin path" do it "is routable" do expect(get("/admin/login")).to route_to("admin/user_sessions#new") end end context "and making a request for the root path" do it "is redirected to /admin" do expect(get("/")).to permanently_redirect_to("https://moderate.petition.parliament.uk/admin") end end end end