Commit a3c6ba2
Changed files (4)
app
controllers
views
profiles
config
spec
controllers
app/controllers/profiles_controller.rb
@@ -0,0 +1,5 @@
+class ProfilesController < PublicController
+ def show
+ @user = User.find_by(username: params[:id])
+ end
+end
app/views/profiles/show.html.erb
config/routes.rb
@@ -8,6 +8,7 @@ Rails.application.routes.draw do
end
end
resources :programs, only: [:show]
+ resources :profiles, only: [:show]
get "/dashboard" => "training_sessions#index", as: :dashboard
get "/terms" => "static_pages#terms"
end
spec/controllers/profiles_controller_spec.rb
@@ -0,0 +1,12 @@
+require "rails_helper"
+
+describe ProfilesController do
+ describe "#show" do
+ let(:user) { create(:user) }
+
+ it "loads the users profile" do
+ get :show, id: user.username
+ expect(assigns(:user)).to eql(user)
+ end
+ end
+end