Commit 7146ea1
Changed files (2)
config
spec
routing
config/routes.rb
@@ -9,6 +9,7 @@ Rails.application.routes.draw do
end
resources :programs, only: [:show]
resources :profiles, only: [:show]
+ get "/u/:id" => "profiles#show"
get "/dashboard" => "training_sessions#index", as: :dashboard
get "/terms" => "static_pages#terms"
end
spec/routing/profiles_routing_spec.rb
@@ -0,0 +1,19 @@
+require "rails_helper"
+
+describe "/profiles" do
+ it "routes to /profiles/<username>" do
+ expect(get: "/profiles/mokha").to route_to(
+ controller: "profiles",
+ action: "show",
+ id: "mokha"
+ )
+ end
+
+ it "routes to /u/<username>" do
+ expect(get: "/u/mokha").to route_to(
+ controller: "profiles",
+ action: "show",
+ id: "mokha"
+ )
+ end
+end