Skip to content

Commit

Permalink
add routing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
one-m1nd committed Mar 10, 2024
1 parent e33d689 commit 55aca7f
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 0 deletions.
38 changes: 38 additions & 0 deletions spec/routing/families_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions spec/routing/genera_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions spec/routing/plants_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions spec/routing/watertrackers_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 55aca7f

Please sign in to comment.