Commit c7dacd8
Changed files (4)
app
controllers
views
gyms
config
spec
controllers
app/controllers/gyms_controller.rb
@@ -8,6 +8,10 @@ class GymsController < ApplicationController
)
end
+ def show
+ @gym = Gym.find(params[:id])
+ end
+
def new
@gym = Gym.new
@gym.build_location
app/views/gyms/show.html.erb
@@ -0,0 +1,6 @@
+
+<div class="row">
+ <div class="large-12columns">
+ <%= react_component('Comment', { author: 'mo', body: 'nice', rank: 5 }) %>
+ </div>
+</div>
config/routes.rb
@@ -10,7 +10,7 @@ Rails.application.routes.draw do
end
resources :programs, only: [:show]
resources :profiles, only: [:new, :create, :show, :edit, :update], constraints: { id: /[^\/]+/ }
- resources :gyms, only: [:index, :new, :create]
+ resources :gyms, only: [:index, :show, :new, :create]
get "/u/:id" => "profiles#show", constraints: { id: /[^\/]+/ }
get "/dashboard" => "training_sessions#index", as: :dashboard
get "/terms" => "static_pages#terms"
spec/controllers/gyms_controller_spec.rb
@@ -99,4 +99,12 @@ describe GymsController do
end
end
end
+
+ describe "#show" do
+ it 'loads the gym' do
+ gym = create(:gym)
+ get :show, id: gym.id
+ expect(assigns(:gym)).to eql(gym)
+ end
+ end
end