Here is what I came up with:
context "as any user" do
describe "not routable actions" do
it "rejects routing for :new" do
expect(get: "/products/new").not_to be_routable
end
it "rejects routing for :create" do
expect(post: "/products").not_to be_routable
end
it "rejects routing for :edit" do
expect(get: "/products/#{@product.id}/edit").not_to be_routable
end
it "rejects routing for :update" do
expect(put: "/products/#{@product.id}").not_to be_routable
end
it "rejects routing for :destroy" do
expect(delete: "/products/#{@product.id}").not_to be_routable
end
end
end
However one test fails:
Failure/Error: expect(get: "/products/new").not_to be_routable
expected {:get=>"/products/new"} not to be routable,
but it routes to {:action=>"show", :controller=>"products", :id=>"new"}
Please feel free to add your own solution if you follow a totally different approach to test non-existing routes.