Skip to content

Commit

Permalink
Correcting spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kmalick committed Oct 31, 2024
1 parent 5f2dd73 commit 484d0cf
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 40 deletions.
17 changes: 8 additions & 9 deletions spec/routing/courses_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
require "rails_helper"

RSpec.describe CoursesController, type: :routing do
RSpec.describe Api::V1::CoursesController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(get: "/courses").to route_to("courses#index")
expect(get: "/api/v1/courses").to route_to("api/v1/courses#index")
end

it "routes to #show" do
expect(get: "/courses/1").to route_to("courses#show", id: "1")
expect(get: "/api/v1/courses/1").to route_to("api/v1/courses#show", id: "1")
end


it "routes to #create" do
expect(post: "/courses").to route_to("courses#create")
expect(post: "/api/v1/courses").to route_to("api/v1/courses#create")
end

it "routes to #update via PUT" do
expect(put: "/courses/1").to route_to("courses#update", id: "1")
expect(put: "/api/v1/courses/1").to route_to("api/v1/courses#update", id: "1")
end

it "routes to #update via PATCH" do
expect(patch: "/courses/1").to route_to("courses#update", id: "1")
expect(patch: "/api/v1/courses/1").to route_to("api/v1/courses#update", id: "1")
end

it "routes to #destroy" do
expect(delete: "/courses/1").to route_to("courses#destroy", id: "1")
expect(delete: "/api/v1/courses/1").to route_to("api/v1/courses#destroy", id: "1")
end
end
end
end
22 changes: 8 additions & 14 deletions spec/routing/join_team_requests_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
require "rails_helper"

RSpec.describe JoinTeamRequestsController, type: :routing do
RSpec.describe Api::V1::JoinTeamRequestsController, type: :routing do
describe "routing" do
# Routes to the #index action
it "routes to #index" do
expect(get: "/join_team_requests").to route_to("join_team_requests#index")
expect(get: "/api/v1/join_team_requests").to route_to("api/v1/join_team_requests#index")
end

# Routes to the #show action with a specific ID
it "routes to #show" do
expect(get: "/join_team_requests/1").to route_to("join_team_requests#show", id: "1")
expect(get: "/api/v1/join_team_requests/1").to route_to("api/v1/join_team_requests#show", id: "1")
end

# Routes to the #create action
it "routes to #create" do
expect(post: "/join_team_requests").to route_to("join_team_requests#create")
expect(post: "/api/v1/join_team_requests").to route_to("api/v1/join_team_requests#create")
end

# Routes to the #update action via PUT
it "routes to #update via PUT" do
expect(put: "/join_team_requests/1").to route_to("join_team_requests#update", id: "1")
expect(put: "/api/v1/join_team_requests/1").to route_to("api/v1/join_team_requests#update", id: "1")
end

# Routes to the #update action via PATCH
it "routes to #update via PATCH" do
expect(patch: "/join_team_requests/1").to route_to("join_team_requests#update", id: "1")
expect(patch: "/api/v1/join_team_requests/1").to route_to("api/v1/join_team_requests#update", id: "1")
end

# Routes to the #destroy action
it "routes to #destroy" do
expect(delete: "/join_team_requests/1").to route_to("join_team_requests#destroy", id: "1")
expect(delete: "/api/v1/join_team_requests/1").to route_to("api/v1/join_team_requests#destroy", id: "1")
end
end
end
end
17 changes: 8 additions & 9 deletions spec/routing/sign_up_topics_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
require "rails_helper"

RSpec.describe SignUpTopicsController, type: :routing do
RSpec.describe Api::V1::SignUpTopicsController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(get: "/sign_up_topics").to route_to("sign_up_topics#index")
expect(get: "/api/v1/sign_up_topics").to route_to("api/v1/sign_up_topics#index")
end

it "routes to #show" do
expect(get: "/sign_up_topics/1").to route_to("sign_up_topics#show", id: "1")
expect(get: "/api/v1/sign_up_topics/1").to route_to("api/v1/sign_up_topics#show", id: "1")
end


it "routes to #create" do
expect(post: "/sign_up_topics").to route_to("sign_up_topics#create")
expect(post: "/api/v1/sign_up_topics").to route_to("api/v1/sign_up_topics#create")
end

it "routes to #update via PUT" do
expect(put: "/sign_up_topics/1").to route_to("sign_up_topics#update", id: "1")
expect(put: "/api/v1/sign_up_topics/1").to route_to("api/v1/sign_up_topics#update", id: "1")
end

it "routes to #update via PATCH" do
expect(patch: "/sign_up_topics/1").to route_to("sign_up_topics#update", id: "1")
expect(patch: "/api/v1/sign_up_topics/1").to route_to("api/v1/sign_up_topics#update", id: "1")
end

it "routes to #destroy" do
expect(delete: "/sign_up_topics/1").to route_to("sign_up_topics#destroy", id: "1")
expect(delete: "/api/v1/sign_up_topics/1").to route_to("api/v1/sign_up_topics#destroy", id: "1")
end
end
end
end
15 changes: 7 additions & 8 deletions spec/routing/student_tasks_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
require "rails_helper"

RSpec.describe StudentTasksController, type: :routing do
RSpec.describe Api::V1::StudentTasksController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(get: "/student_tasks").to route_to("student_tasks#index")
expect(get: "/api/v1/student_tasks").to route_to("api/v1/student_tasks#index")
end

it "routes to #show" do
expect(get: "/student_tasks/1").to route_to("student_tasks#show", id: "1")
expect(get: "/api/v1/student_tasks/1").to route_to("api/v1/student_tasks#show", id: "1")
end


it "routes to #create" do
expect(post: "/student_tasks").to route_to("student_tasks#create")
expect(post: "/api/v1/student_tasks").to route_to("api/v1/student_tasks#create")
end

it "routes to #update via PUT" do
expect(put: "/student_tasks/1").to route_to("student_tasks#update", id: "1")
expect(put: "/api/v1/student_tasks/1").to route_to("api/v1/student_tasks#update", id: "1")
end

it "routes to #update via PATCH" do
expect(patch: "/student_tasks/1").to route_to("student_tasks#update", id: "1")
expect(patch: "/api/v1/student_tasks/1").to route_to("api/v1/student_tasks#update", id: "1")
end

it "routes to #destroy" do
expect(delete: "/student_tasks/1").to route_to("student_tasks#destroy", id: "1")
expect(delete: "/api/v1/student_tasks/1").to route_to("api/v1/student_tasks#destroy", id: "1")
end
end
end

0 comments on commit 484d0cf

Please sign in to comment.