From 55aca7f8f93bd847dfe219a5e4288b4518c60b22 Mon Sep 17 00:00:00 2001 From: Xero Date: Sun, 10 Mar 2024 12:37:18 -0400 Subject: [PATCH] add routing tests --- spec/routing/families_routing_spec.rb | 38 ++++++++++++++++++++++ spec/routing/genera_routing_spec.rb | 38 ++++++++++++++++++++++ spec/routing/plants_routing_spec.rb | 38 ++++++++++++++++++++++ spec/routing/watertrackers_routing_spec.rb | 38 ++++++++++++++++++++++ 4 files changed, 152 insertions(+) create mode 100644 spec/routing/families_routing_spec.rb create mode 100644 spec/routing/genera_routing_spec.rb create mode 100644 spec/routing/plants_routing_spec.rb create mode 100644 spec/routing/watertrackers_routing_spec.rb diff --git a/spec/routing/families_routing_spec.rb b/spec/routing/families_routing_spec.rb new file mode 100644 index 0000000..b1bd60b --- /dev/null +++ b/spec/routing/families_routing_spec.rb @@ -0,0 +1,38 @@ +require "rails_helper" + +RSpec.describe FamiliesController, type: :routing do + describe "routing" do + it "routes to #index" do + expect(get: "/families").to route_to("families#index") + end + + it "routes to #new" do + expect(get: "/families/new").to route_to("families#new") + end + + it "routes to #show" do + expect(get: "/families/1").to route_to("families#show", id: "1") + end + + it "routes to #edit" do + expect(get: "/families/1/edit").to route_to("families#edit", id: "1") + end + + + it "routes to #create" do + expect(post: "/families").to route_to("families#create") + end + + it "routes to #update via PUT" do + expect(put: "/families/1").to route_to("families#update", id: "1") + end + + it "routes to #update via PATCH" do + expect(patch: "/families/1").to route_to("families#update", id: "1") + end + + it "routes to #destroy" do + expect(delete: "/families/1").to route_to("families#destroy", id: "1") + end + end +end diff --git a/spec/routing/genera_routing_spec.rb b/spec/routing/genera_routing_spec.rb new file mode 100644 index 0000000..ffa3938 --- /dev/null +++ b/spec/routing/genera_routing_spec.rb @@ -0,0 +1,38 @@ +require "rails_helper" + +RSpec.describe GeneraController, type: :routing do + describe "routing" do + it "routes to #index" do + expect(get: "/genera").to route_to("genera#index") + end + + it "routes to #new" do + expect(get: "/genera/new").to route_to("genera#new") + end + + it "routes to #show" do + expect(get: "/genera/1").to route_to("genera#show", id: "1") + end + + it "routes to #edit" do + expect(get: "/genera/1/edit").to route_to("genera#edit", id: "1") + end + + + it "routes to #create" do + expect(post: "/genera").to route_to("genera#create") + end + + it "routes to #update via PUT" do + expect(put: "/genera/1").to route_to("genera#update", id: "1") + end + + it "routes to #update via PATCH" do + expect(patch: "/genera/1").to route_to("genera#update", id: "1") + end + + it "routes to #destroy" do + expect(delete: "/genera/1").to route_to("genera#destroy", id: "1") + end + end +end diff --git a/spec/routing/plants_routing_spec.rb b/spec/routing/plants_routing_spec.rb new file mode 100644 index 0000000..e14d0ac --- /dev/null +++ b/spec/routing/plants_routing_spec.rb @@ -0,0 +1,38 @@ +require "rails_helper" + +RSpec.describe PlantsController, type: :routing do + describe "routing" do + it "routes to #index" do + expect(get: "/plants").to route_to("plants#index") + end + + it "routes to #new" do + expect(get: "/plants/new").to route_to("plants#new") + end + + it "routes to #show" do + expect(get: "/plants/1").to route_to("plants#show", id: "1") + end + + it "routes to #edit" do + expect(get: "/plants/1/edit").to route_to("plants#edit", id: "1") + end + + + it "routes to #create" do + expect(post: "/plants").to route_to("plants#create") + end + + it "routes to #update via PUT" do + expect(put: "/plants/1").to route_to("plants#update", id: "1") + end + + it "routes to #update via PATCH" do + expect(patch: "/plants/1").to route_to("plants#update", id: "1") + end + + it "routes to #destroy" do + expect(delete: "/plants/1").to route_to("plants#destroy", id: "1") + end + end +end diff --git a/spec/routing/watertrackers_routing_spec.rb b/spec/routing/watertrackers_routing_spec.rb new file mode 100644 index 0000000..187dbae --- /dev/null +++ b/spec/routing/watertrackers_routing_spec.rb @@ -0,0 +1,38 @@ +require "rails_helper" + +RSpec.describe WatertrackersController, type: :routing do + describe "routing" do + it "routes to #index" do + expect(get: "/watertrackers").to route_to("watertrackers#index") + end + + it "routes to #new" do + expect(get: "/watertrackers/new").to route_to("watertrackers#new") + end + + it "routes to #show" do + expect(get: "/watertrackers/1").to route_to("watertrackers#show", id: "1") + end + + it "routes to #edit" do + expect(get: "/watertrackers/1/edit").to route_to("watertrackers#edit", id: "1") + end + + + it "routes to #create" do + expect(post: "/watertrackers").to route_to("watertrackers#create") + end + + it "routes to #update via PUT" do + expect(put: "/watertrackers/1").to route_to("watertrackers#update", id: "1") + end + + it "routes to #update via PATCH" do + expect(patch: "/watertrackers/1").to route_to("watertrackers#update", id: "1") + end + + it "routes to #destroy" do + expect(delete: "/watertrackers/1").to route_to("watertrackers#destroy", id: "1") + end + end +end