diff --git a/app/controllers/workouts_controller.rb b/app/controllers/workouts_controller.rb index b02362a..0c2d8a2 100644 --- a/app/controllers/workouts_controller.rb +++ b/app/controllers/workouts_controller.rb @@ -2,4 +2,8 @@ class WorkoutsController < ApplicationController def index @workouts = Workout.all end + + def show + @workout = Workout.find(params[:id]) + end end diff --git a/app/views/workouts/show.html.erb b/app/views/workouts/show.html.erb new file mode 100644 index 0000000..07eed19 --- /dev/null +++ b/app/views/workouts/show.html.erb @@ -0,0 +1 @@ +<%= @workout.date %> diff --git a/spec/features/workouts_spec.rb b/spec/features/workouts_spec.rb index 9d7ac30..04321c9 100644 --- a/spec/features/workouts_spec.rb +++ b/spec/features/workouts_spec.rb @@ -16,4 +16,16 @@ describe "Workouts" do page.should have_content @workout.date end end + + describe "GET /workouts/(:id)" do + it "should return 200" do + visit "#{workouts_path}/#{@workout.id}" + page.status_code.should be 200 + end + + it "should return the correct workout" do + visit "#{workouts_path}/#{@workout.id}" + page.should have_content @workout.date + end + end end