diff --git a/Gemfile.lock b/Gemfile.lock index 3775e6946..2dbd7d796 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,8 +97,6 @@ GEM faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-net_http (3.0.2) - figaro (1.2.0) - thor (>= 0.14.0, < 2) globalid (1.1.0) activesupport (>= 5.0) hashdiff (1.0.1) @@ -275,7 +273,6 @@ DEPENDENCIES bootsnap capybara faraday - figaro importmap-rails jbuilder launchy diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 9e3ef438f..641139a48 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,4 +1,8 @@

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

Welcome, <%= @user.name %>!

Email: <%= @user.email %>

-

<%= link_to "Landing Page", root_path %>

+

<%= link_to "Landing Page", root_path %>

+ +

My Viewing Parties

+ +

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

\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index e9814af8d..a46d5efd5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,4 +8,5 @@ root to: 'landing_page#index' resources :users, only: %i[show new create] + resources :discover, only: [:index] end diff --git a/coverage/.last_run.json b/coverage/.last_run.json index 0e4f96677..3b1151b00 100644 --- a/coverage/.last_run.json +++ b/coverage/.last_run.json @@ -1,5 +1,5 @@ { "result": { - "line": 93.65 + "line": 93.44 } } diff --git a/coverage/.resultset.json b/coverage/.resultset.json index 1bed9339d..99c84cfcd 100644 --- a/coverage/.resultset.json +++ b/coverage/.resultset.json @@ -1,12 +1,12 @@ { "RSpec": { "coverage": { - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/spec/spec_helper.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/spec/spec_helper.rb": { "lines": [ 1 ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/config/environment.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/config/environment.rb": { "lines": [ null, null, @@ -17,7 +17,7 @@ 1 ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/config/application.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/config/application.rb": { "lines": [ null, null, @@ -60,7 +60,7 @@ null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/config/boot.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/config/boot.rb": { "lines": [ null, null, @@ -70,7 +70,7 @@ 1 ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/config/environments/test.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/config/environments/test.rb": { "lines": [ null, null, @@ -136,7 +136,7 @@ null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/config/initializers/assets.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/config/initializers/assets.rb": { "lines": [ null, null, @@ -154,7 +154,7 @@ null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/config/initializers/content_security_policy.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/config/initializers/content_security_policy.rb": { "lines": [ null, null, @@ -184,7 +184,7 @@ null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/config/initializers/filter_parameter_logging.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/config/initializers/filter_parameter_logging.rb": { "lines": [ null, null, @@ -198,7 +198,7 @@ null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/config/initializers/inflections.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/config/initializers/inflections.rb": { "lines": [ null, null, @@ -219,7 +219,7 @@ null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/config/initializers/permissions_policy.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/config/initializers/permissions_policy.rb": { "lines": [ null, null, @@ -235,7 +235,7 @@ null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/config/routes.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/config/routes.rb": { "lines": [ null, null, @@ -247,10 +247,11 @@ 1, null, 1, + 1, null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/app/helpers/application_helper.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/app/helpers/application_helper.rb": { "lines": [ null, null, @@ -258,19 +259,19 @@ null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/app/helpers/landing_page_helper.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/app/helpers/landing_page_helper.rb": { "lines": [ 1, null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/app/models/user.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/app/models/user.rb": { "lines": [ 1, null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/app/models/application_record.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/app/models/application_record.rb": { "lines": [ null, null, @@ -279,29 +280,12 @@ null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/app/controllers/landing_page_controller.rb": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/app/controllers/users_controller.rb": { "lines": [ 1, 1, 2, null, - null - ] - }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/app/controllers/application_controller.rb": { - "lines": [ - null, - null, - 1, - null - ] - }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/app/controllers/users_controller.rb": { - "lines": [ - 1, - 1, - 1, - null, null, 1, null, @@ -317,8 +301,16 @@ null, null ] + }, + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/app/controllers/application_controller.rb": { + "lines": [ + null, + null, + 1, + null + ] } }, - "timestamp": 1696973543 + "timestamp": 1697039978 } } diff --git a/coverage/index.html b/coverage/index.html index c7238d6d5..651cd0f66 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -14,7 +14,7 @@ loading
-
Generated 2023-10-10T15:32:23-06:00
+
Generated 2023-10-11T09:59:38-06:00
@@ -23,7 +23,7 @@

All Files ( - 93.65% + 93.44% @@ -39,15 +39,15 @@

- 18 files in total. + 17 files in total.
- 63 relevant lines, - 59 lines covered and + 61 relevant lines, + 57 lines covered and 4 lines missed. ( - 93.65% + 93.44% )
@@ -71,7 +71,7 @@

- app/controllers/application_controller.rb + app/controllers/application_controller.rb 100.00 % 4 1 @@ -82,29 +82,18 @@

- app/controllers/landing_page_controller.rb - 100.00 % - 5 - 3 - 3 - 0 - 1.33 - - - - - app/controllers/users_controller.rb + app/controllers/users_controller.rb 55.56 % 18 9 5 4 - 0.56 + 0.67 - app/helpers/application_helper.rb + app/helpers/application_helper.rb 100.00 % 4 1 @@ -115,7 +104,7 @@

- app/helpers/landing_page_helper.rb + app/helpers/landing_page_helper.rb 100.00 % 2 1 @@ -126,7 +115,7 @@

- app/models/application_record.rb + app/models/application_record.rb 100.00 % 5 2 @@ -137,7 +126,7 @@

- app/models/user.rb + app/models/user.rb 100.00 % 2 1 @@ -148,7 +137,7 @@

- config/application.rb + config/application.rb 100.00 % 39 17 @@ -159,7 +148,7 @@

- config/boot.rb + config/boot.rb 100.00 % 6 3 @@ -170,7 +159,7 @@

- config/environment.rb + config/environment.rb 100.00 % 7 2 @@ -181,7 +170,7 @@

- config/environments/test.rb + config/environments/test.rb 100.00 % 62 17 @@ -192,7 +181,7 @@

- config/initializers/assets.rb + config/initializers/assets.rb 100.00 % 14 1 @@ -203,7 +192,7 @@

- config/initializers/content_security_policy.rb + config/initializers/content_security_policy.rb 100.00 % 26 0 @@ -214,7 +203,7 @@

- config/initializers/filter_parameter_logging.rb + config/initializers/filter_parameter_logging.rb 100.00 % 10 1 @@ -225,7 +214,7 @@

- config/initializers/inflections.rb + config/initializers/inflections.rb 100.00 % 17 0 @@ -236,7 +225,7 @@

- config/initializers/permissions_policy.rb + config/initializers/permissions_policy.rb 100.00 % 12 0 @@ -247,18 +236,18 @@

- config/routes.rb + config/routes.rb 100.00 % - 11 - 3 - 3 + 12 + 4 + 4 0 1.00 - spec/spec_helper.rb + spec/spec_helper.rb 100.00 % 1 1 @@ -285,7 +274,7 @@

-
+

app/controllers/application_controller.rb

@@ -360,93 +349,7 @@

-
-
-

app/controllers/landing_page_controller.rb

-

- - 100.0% - - - lines covered -

- - - -
- 3 relevant lines. - 3 lines covered and - 0 lines missed. -
- - - -
- -
-    
    - -
    -
  1. - 1 - - - - - class LandingPageController < ApplicationController -
  2. -
    - -
    -
  3. - 1 - - - - - def index -
  4. -
    - -
    -
  5. - 2 - - - - - @users = User.all -
  6. -
    - -
    -
  7. - - - - - - end -
  8. -
    - -
    -
  9. - - - - - - end -
  10. -
    - -
-
-
- - -
+

app/controllers/users_controller.rb

@@ -495,8 +398,8 @@

-
  • - 1 +
  • + 2 @@ -589,7 +492,7 @@

    - @user = User.new(name: params[:user][:name], email: params[:user][:email]) + @user = User.new(name: params[:name], email: params[:email])

  • @@ -675,7 +578,7 @@

    -
    +

    app/helpers/application_helper.rb

    @@ -750,7 +653,7 @@

    -
    +

    app/helpers/landing_page_helper.rb

    @@ -803,7 +706,7 @@

    -
    +

    app/models/application_record.rb

    @@ -889,7 +792,7 @@

    -
    +

    app/models/user.rb

    @@ -942,7 +845,7 @@

    -
    +

    config/application.rb

    @@ -1402,7 +1305,7 @@

    -
    +

    config/boot.rb

    @@ -1499,7 +1402,7 @@

    -
    +

    config/environment.rb

    @@ -1607,7 +1510,7 @@

    -
    +

    config/environments/test.rb

    @@ -2320,7 +2223,7 @@

    -
    +

    config/initializers/assets.rb

    @@ -2505,7 +2408,7 @@

    -
    +

    config/initializers/content_security_policy.rb

    @@ -2822,7 +2725,7 @@

    -
    +

    config/initializers/filter_parameter_logging.rb

    @@ -2963,7 +2866,7 @@

    -
    +

    config/initializers/inflections.rb

    @@ -3181,7 +3084,7 @@

    -
    +

    config/initializers/permissions_policy.rb

    @@ -3344,7 +3247,7 @@

    -
    +

    config/routes.rb

    @@ -3358,8 +3261,8 @@

    - 3 relevant lines. - 3 lines covered and + 4 relevant lines. + 4 lines covered and 0 lines missed.
    @@ -3481,7 +3384,18 @@

    -
  • +
  • + 1 + + + + + resources :discover, only: [:index] +
  • +
    + +
    +
  • @@ -3496,7 +3410,7 @@

  • -
    +

    spec/spec_helper.rb

    diff --git a/db/migrate/20231010202346_create_users.rb b/db/migrate/20231010202346_create_users.rb index a5c65cb8b..82b2903b7 100644 --- a/db/migrate/20231010202346_create_users.rb +++ b/db/migrate/20231010202346_create_users.rb @@ -2,7 +2,7 @@ class CreateUsers < ActiveRecord::Migration[7.0] def change create_table :users do |t| t.string :name - t.string :email + t.string :email, index: { unique: true, name: 'unique_emails' } t.timestamps end diff --git a/db/migrate/20231011154908_create_viewing_parties.rb b/db/migrate/20231011154908_create_viewing_parties.rb new file mode 100644 index 000000000..7963f2da2 --- /dev/null +++ b/db/migrate/20231011154908_create_viewing_parties.rb @@ -0,0 +1,13 @@ +class CreateViewingParties < ActiveRecord::Migration[7.0] + def change + create_table :viewing_parties do |t| + t.string :movie_title + t.integer :movie_id + t.string :movie_image + t.integer :duration + t.datetime :start_time + + t.timestamps + end + end +end diff --git a/db/migrate/20231011155415_create_user_viewing_parties.rb b/db/migrate/20231011155415_create_user_viewing_parties.rb new file mode 100644 index 000000000..674c55eba --- /dev/null +++ b/db/migrate/20231011155415_create_user_viewing_parties.rb @@ -0,0 +1,11 @@ +class CreateUserViewingParties < ActiveRecord::Migration[7.0] + def change + create_table :user_viewing_parties do |t| + t.references :user, null: false, foreign_key: true + t.references :viewing_party, null: false, foreign_key: true + t.boolean :hosting + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index a393fbad0..0f7cc31f6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,15 +10,38 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_10_10_202346) do +ActiveRecord::Schema[7.0].define(version: 2023_10_11_155415) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" + create_table "user_viewing_parties", force: :cascade do |t| + t.bigint "user_id", null: false + t.bigint "viewing_party_id", null: false + t.boolean "hosting" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_user_viewing_parties_on_user_id" + t.index ["viewing_party_id"], name: "index_user_viewing_parties_on_viewing_party_id" + end + create_table "users", force: :cascade do |t| t.string "name" t.string "email" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["email"], name: "unique_emails", unique: true + end + + create_table "viewing_parties", force: :cascade do |t| + t.string "movie_title" + t.integer "movie_id" + t.string "movie_image" + t.integer "duration" + t.datetime "start_time" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end + add_foreign_key "user_viewing_parties", "users" + add_foreign_key "user_viewing_parties", "viewing_parties" end diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb new file mode 100644 index 000000000..7c246e232 --- /dev/null +++ b/spec/features/users/show_spec.rb @@ -0,0 +1,42 @@ +require 'rails_helper' + +RSpec.describe "User Show Page/ Dashboard" do + before :each do + @u1 = User.create!(name: 'Brian', email: 'brian@brian.com') + @u2 = User.create!(name: 'Lorien', email: 'lorienlorienl.com') + @u3 = User.create!(name: 'Rachel', email: 'rachel@rachel.com') + + # @vp1 = @u1.viewingparties.create!(title: "Movie 1", movie_id: 1, movie_image:,duration: 119, date: "10-31-2023", start_time: "09:00" ) + # @vp2 = @u1.viewingparties.create!(title: "Movie 2", movie_id: 2, movie_image:,duration: 100, date: "11-13-2023", start_time: "13:00" ) + end + + it "shows the User's information on the page" do + visit user_path(@u1) + + expect(page).to have_content("Brian's Dashboard") + expect(page).to have_content("brian@brian.com") + expect(page).to_not have_content("Rachel's Dashboard") + expect(page).to_not have_content("rachel@rachel.com") + end + + it "has a section for the viewing parties that a user has signed up for" do + visit user_path(@u2) + + within("#viewing_parties") do + expect(page).to have_content("My Viewing Parties") + end + + end + + xit "has a button to take the user to discover movies" do + visit user_path(@u3) + + within("#discover") do + expect(page).to have_button("Discover Movies") + + click_button "Discover Movies" + + expect(current_path).to eq user_discover_path(@u3) + end + end +end \ No newline at end of file