require "rails_helper"

RSpec.feature "Listing Exercises" do
  before do
    @john = User.create!(email: "john@example.com", password: "password")
    login_as(@john)

    @e1 = @john.exercises.create(duration_in_minutes: 20,
                                workout: "My body building activity",
                                workout_date: Date.today )

    @e2 = @john.exercises.create(duration_in_minutes: 55,
                                workout: "Weight lifting",
                                workout_date: 2.days.ago )
  end

  scenario "shows user's for the last 7 days" do
    visit "/"
    click_link "My Lounge"

    expect(page).to have_content(@e1.duration_in_minutes)
    expect(page).to have_content(@e1.workout)
    expect(page).to have_content(@e1.workout_date)

    expect(page).to have_content(@e2.duration_in_minutes)
    expect(page).to have_content(@e2.workout)
    expect(page).to have_content(@e2.workout_date)

  end

end

require "rails_helper"

RSpec.feature "Listing Exercises" do
  before do
    @john = User.create!(email: "john@example.com", password: "password")
    login_as(@john)

    @e1 = @john.exercises.create(duration_in_minutes: 20,
                                workout: "My body building activity",
                                workout_date: Date.today )

    @e2 = @john.exercises.create(duration_in_minutes: 55,
                                workout: "Weight lifting",
                                workout_date: 2.days.ago )
  end

  scenario "shows user's for the last 7 days" do
    visit "/"
    click_link "My Lounge"

    expect(page).to have_content(@e1.duration_in_minutes)
    expect(page).to have_content(@e1.workout)
    expect(page).to have_content(@e1.workout_date)

    expect(page).to have_content(@e2.duration_in_minutes)
    expect(page).to have_content(@e2.workout)
    expect(page).to have_content(@e2.workout_date)

  end

  scenario "shows message if no exercises exist" do
    @john.exercises.delete_all

    visit "/"
    click_link "My Lounge"

    expect(page).to have_content("No Workouts Yet")

  end

end

Implement test of no exercises in Lounge
Implement test of no exercises in Lounge
