From 10d8b0d1f49bc4cd37e386dca538d8b906b9a7cd Mon Sep 17 00:00:00 2001 From: Cory Powell Date: Tue, 28 Nov 2023 20:03:05 -0500 Subject: [PATCH 1/4] removed a test on line 48 that checks for an email to be on the page. The show page user story doesn't call for the email so I just removed it and removed the corresponding line in the test. --- spec/features/landing_page/index_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/features/landing_page/index_spec.rb b/spec/features/landing_page/index_spec.rb index 971993798..0c21b59c8 100644 --- a/spec/features/landing_page/index_spec.rb +++ b/spec/features/landing_page/index_spec.rb @@ -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") From 0196888707bc2a8f5f49370b7fdb6af8189e5e82 Mon Sep 17 00:00:00 2001 From: Cory Powell Date: Tue, 28 Nov 2023 20:03:53 -0500 Subject: [PATCH 2/4] added testing for the user_dashboard_page user story and corresponding code in the view/show page --- Gemfile | 2 +- app/views/users/show.html.erb | 5 +++-- config/routes.rb | 2 +- spec/features/users/show_spec.rb | 35 ++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 spec/features/users/show_spec.rb diff --git a/Gemfile b/Gemfile index 86eb7c0d3..70921e323 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index cd3401b21..3ea75aded 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,4 +1,5 @@ +

<%=@user.name%>'s Dashboard

+<%= button_to "Discover Movies" %> -<%= @user.name %> -<%= @user.email %> \ No newline at end of file +

Viewing Parties:

\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3b4559db0..f0abd084a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ # root "users#index" get "/", to: "users#index" + get "/users/:id", to: "users#show" get "/new", to: "users#new" post "/", to: "users#create" - get "/users/:id", to: "users#show" end diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb new file mode 100644 index 000000000..42de2026c --- /dev/null +++ b/spec/features/users/show_spec.rb @@ -0,0 +1,35 @@ +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 + # When I visit '/users/:id' where :id is a valid user id, + # I should see: + # "'s Dashboard" at the top of the page + # A button to Discover Movies* + # A section that lists viewing parties** + # *more instructions on this in the Dashboard:Discover Movies issue. + # **more instructions on this in the Dashboard:Viewing Parties issue. + + describe "When I visit '/users/:id'" do + it "should show ' 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 + end +end From 5167424efbc8532c124ad0acef9b0e8d7f83e1d6 Mon Sep 17 00:00:00 2001 From: Cory Powell Date: Tue, 28 Nov 2023 20:28:08 -0500 Subject: [PATCH 3/4] created testing for the dashboard: discover movies user story along with a movies controller, a movies view folder, a movies index page, and routing for the discover page corresponding to a specific user. --- app/controllers/movies_controller.rb | 3 +++ app/views/movies/index.html.erb | 0 app/views/users/show.html.erb | 2 +- config/routes.rb | 1 + spec/features/users/show_spec.rb | 16 +++++++++------- 5 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 app/controllers/movies_controller.rb create mode 100644 app/views/movies/index.html.erb diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb new file mode 100644 index 000000000..4f6ad2f3c --- /dev/null +++ b/app/controllers/movies_controller.rb @@ -0,0 +1,3 @@ +class MoviesController < ApplicationController + def index; end +end diff --git a/app/views/movies/index.html.erb b/app/views/movies/index.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 3ea75aded..08d355f8d 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,5 +1,5 @@

<%=@user.name%>'s Dashboard

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

Viewing Parties:

\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f0abd084a..c91f59a94 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,7 @@ # root "users#index" get "/", to: "users#index" get "/users/:id", to: "users#show" + get "/users/:id/discover", to: "movies#index" get "/new", to: "users#new" post "/", to: "users#create" end diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb index 42de2026c..714d73ab0 100644 --- a/spec/features/users/show_spec.rb +++ b/spec/features/users/show_spec.rb @@ -5,13 +5,6 @@ @user1 = User.create!(name: "Scott DeVoss", email: "scottd@gmail.com") @user2 = User.create!(name: "Cory Powell", email: "coryp@yahoo.com") end - # When I visit '/users/:id' where :id is a valid user id, - # I should see: - # "'s Dashboard" at the top of the page - # A button to Discover Movies* - # A section that lists viewing parties** - # *more instructions on this in the Dashboard:Discover Movies issue. - # **more instructions on this in the Dashboard:Viewing Parties issue. describe "When I visit '/users/:id'" do it "should show ' Dashboard' at the top of the page" do @@ -31,5 +24,14 @@ 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 From 85b7f77c90ed99e19e9dbf6632c304a9439dcd83 Mon Sep 17 00:00:00 2001 From: Cory Powell Date: Tue, 28 Nov 2023 22:29:18 -0500 Subject: [PATCH 4/4] changed the title of the discover controller to discover. I thought I was being clever doing a movies_controller, but I think the movies have to be a different thing and discover seems to be its own thing. So changed it to discover#index/controller. --- app/controllers/discover_controller.rb | 3 +++ app/controllers/movies_controller.rb | 3 --- app/views/{movies => discover}/index.html.erb | 0 config/routes.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 app/controllers/discover_controller.rb delete mode 100644 app/controllers/movies_controller.rb rename app/views/{movies => discover}/index.html.erb (100%) diff --git a/app/controllers/discover_controller.rb b/app/controllers/discover_controller.rb new file mode 100644 index 000000000..86ba41015 --- /dev/null +++ b/app/controllers/discover_controller.rb @@ -0,0 +1,3 @@ +class DiscoverController < ApplicationController + def index; end +end diff --git a/app/controllers/movies_controller.rb b/app/controllers/movies_controller.rb deleted file mode 100644 index 4f6ad2f3c..000000000 --- a/app/controllers/movies_controller.rb +++ /dev/null @@ -1,3 +0,0 @@ -class MoviesController < ApplicationController - def index; end -end diff --git a/app/views/movies/index.html.erb b/app/views/discover/index.html.erb similarity index 100% rename from app/views/movies/index.html.erb rename to app/views/discover/index.html.erb diff --git a/config/routes.rb b/config/routes.rb index c91f59a94..0377bd750 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,7 +7,7 @@ # root "users#index" get "/", to: "users#index" get "/users/:id", to: "users#show" - get "/users/:id/discover", to: "movies#index" + get "/users/:id/discover", to: "discover#index" get "/new", to: "users#new" post "/", to: "users#create" end