Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard page #14

Merged
merged 4 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ group :development do

# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
gem "rubocop-rails"
# gem "rubocop-rails"
end

group :test do
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/discover_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class DiscoverController < ApplicationController
def index; end
end
Empty file.
5 changes: 3 additions & 2 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<h2><%=@user.name%>'s Dashboard</h2>

<%= button_to "Discover Movies", "/users/#{@user.id}/discover", method: :get %>

<%= @user.name %>
<%= @user.email %>
<h3>Viewing Parties:</h3>
3 changes: 2 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

# root "users#index"
get "/", to: "users#index"
get "/users/:id", to: "users#show"
get "/users/:id/discover", to: "discover#index"
get "/new", to: "users#new"
post "/", to: "users#create"
get "/users/:id", to: "users#show"
end
1 change: 0 additions & 1 deletion spec/features/landing_page/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
expect(current_path).to eq("/users/#{@user1.id}")

expect(page).to have_content("Scott DeVoss")
expect(page).to have_content("scottd@gmail.com")
expect(page).to_not have_content("Cory Powell")

expect(page).to have_link("Home")
Expand Down
37 changes: 37 additions & 0 deletions spec/features/users/show_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
require "rails_helper"

RSpec.describe "Users show page", type: :feature do
before(:each) do
@user1 = User.create!(name: "Scott DeVoss", email: "scottd@gmail.com")
@user2 = User.create!(name: "Cory Powell", email: "coryp@yahoo.com")
end

describe "When I visit '/users/:id'" do
it "should show '<user's name> Dashboard' at the top of the page" do
visit "/users/#{@user1.id}"

expect(page).to have_content("#{@user1.name}'s Dashboard")
end

it "should have a button to 'Discover Movies'" do
visit "/users/#{@user1.id}"

expect(page).to have_button("Discover Movies")
end

it "should have a section that lists viewing parties" do
visit "/users/#{@user1.id}"

expect(page).to have_content('Viewing Parties:')
end

it "when I go to a user dashboard, and click on 'Discover Movies' I am redirected to a discover
page /users/:id/discover, where :id is the user id of the user who's dashboard I was just on" do
visit "/users/#{@user1.id}"

click_button("Discover Movies")

expect(current_path).to eq("/users/#{@user1.id}/discover")
end
end
end