From 9ddfa15b96e2bdb3401e94bd71ada565e9c37493 Mon Sep 17 00:00:00 2001 From: Noelle Hemphill Date: Tue, 10 Oct 2023 17:21:08 -0600 Subject: [PATCH 1/4] add tests for the users dashboard --- Gemfile.lock | 3 - app/views/users/show.html.erb | 2 +- coverage/.last_run.json | 2 +- coverage/.resultset.json | 59 +++++----- coverage/index.html | 181 +++++++------------------------ spec/features/users/show_spec.rb | 18 +++ 6 files changed, 87 insertions(+), 178 deletions(-) create mode 100644 spec/features/users/show_spec.rb 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..8aa99ebb8 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,4 +1,4 @@

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

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

Email: <%= @user.email %>

-

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

+

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

diff --git a/coverage/.last_run.json b/coverage/.last_run.json index 0e4f96677..bcfebf332 100644 --- a/coverage/.last_run.json +++ b/coverage/.last_run.json @@ -1,5 +1,5 @@ { "result": { - "line": 93.65 + "line": 93.33 } } diff --git a/coverage/.resultset.json b/coverage/.resultset.json index 1bed9339d..2aada4982 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, @@ -250,7 +250,7 @@ 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 +258,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,24 +279,7 @@ null ] }, - "/Users/jorjafleming/mod3/viewing_party_lite/viewing_party_lite_7/app/controllers/landing_page_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": { + "/Users/noellehemphill/turing_work/3mod/projects/viewing_party_lite_7/app/controllers/users_controller.rb": { "lines": [ 1, 1, @@ -317,8 +300,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": 1696979544 } } diff --git a/coverage/index.html b/coverage/index.html index c7238d6d5..9c1e48ffb 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-10T17:12:24-06:00
@@ -23,14 +23,14 @@

All Files ( - 93.65% + 93.33% covered at - 0.95 + 0.93 hits/line ) @@ -39,15 +39,15 @@

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

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

- 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 @@ -104,7 +93,7 @@

- 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,7 +236,7 @@

- config/routes.rb + config/routes.rb 100.00 % 11 3 @@ -258,7 +247,7 @@

- 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

@@ -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

@@ -3496,7 +3399,7 @@

-
+

spec/spec_helper.rb

diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb new file mode 100644 index 000000000..12da60636 --- /dev/null +++ b/spec/features/users/show_spec.rb @@ -0,0 +1,18 @@ +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') + 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 +end \ No newline at end of file From 81c9055f6a823b3af73c5f34ae45562e3e9a2ef7 Mon Sep 17 00:00:00 2001 From: Noelle Hemphill Date: Tue, 10 Oct 2023 20:38:44 -0600 Subject: [PATCH 2/4] test: write tests for the viewing parties section of the users dashboard --- app/views/users/show.html.erb | 2 ++ coverage/.resultset.json | 4 ++-- coverage/index.html | 10 +++++----- spec/features/users/show_spec.rb | 21 +++++++++++++++++++++ 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 8aa99ebb8..a938271c6 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -2,3 +2,5 @@

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

Email: <%= @user.email %>

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

+ +

My Viewing Parties

\ No newline at end of file diff --git a/coverage/.resultset.json b/coverage/.resultset.json index 2aada4982..776adc4e3 100644 --- a/coverage/.resultset.json +++ b/coverage/.resultset.json @@ -283,7 +283,7 @@ "lines": [ 1, 1, - 1, + 2, null, null, 1, @@ -310,6 +310,6 @@ ] } }, - "timestamp": 1696979544 + "timestamp": 1696991884 } } diff --git a/coverage/index.html b/coverage/index.html index 9c1e48ffb..ecfa824d6 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -14,7 +14,7 @@ loading

-
Generated 2023-10-10T17:12:24-06:00
+
Generated 2023-10-10T20:38:04-06:00
    @@ -30,7 +30,7 @@

    covered at - 0.93 + 0.95 hits/line ) @@ -88,7 +88,7 @@

    9 5 4 - 0.56 + 0.67 @@ -398,8 +398,8 @@

    -
  • - 1 +
  • + 2 diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb index 12da60636..972ebd45e 100644 --- a/spec/features/users/show_spec.rb +++ b/spec/features/users/show_spec.rb @@ -5,6 +5,10 @@ @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') + + #leaving these commented out as I haven't figured out the design of this table yet + # @vp1 = @u1.viewingparties.create!(name: "Movie 1", duration: 119, date: "10-31-2023", start_time: "09:00" ) + # @vp2 = @u1.viewingparties.create!(name: "Movie 2", duration: 100, date: "11-13-2023", start_time: "13:00" ) end it "shows the User's information on the page" do @@ -15,4 +19,21 @@ 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 + + it "has a button to take the user to discover movies" do + visit user_path(@u3) + + within("#discover") do + expect(page).to have_button("") + end + end end \ No newline at end of file From c6ca04a6965d24075847924a3bab0040049762a3 Mon Sep 17 00:00:00 2001 From: Noelle Hemphill Date: Tue, 10 Oct 2023 20:43:24 -0600 Subject: [PATCH 3/4] test: write test for the discover movies button --- coverage/.resultset.json | 4 ++-- coverage/index.html | 10 +++++----- spec/features/users/show_spec.rb | 6 +++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/coverage/.resultset.json b/coverage/.resultset.json index 776adc4e3..bfd3aaf44 100644 --- a/coverage/.resultset.json +++ b/coverage/.resultset.json @@ -283,7 +283,7 @@ "lines": [ 1, 1, - 2, + 3, null, null, 1, @@ -310,6 +310,6 @@ ] } }, - "timestamp": 1696991884 + "timestamp": 1696992182 } } diff --git a/coverage/index.html b/coverage/index.html index ecfa824d6..de959ef35 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -14,7 +14,7 @@ loading
  • -
    Generated 2023-10-10T20:38:04-06:00
    +
    Generated 2023-10-10T20:43:02-06:00
      @@ -30,7 +30,7 @@

      covered at - 0.95 + 0.97 hits/line ) @@ -88,7 +88,7 @@

      9 5 4 - 0.67 + 0.78 @@ -398,8 +398,8 @@

      -
    • - 2 +
    • + 3 diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb index 972ebd45e..a4adaec1c 100644 --- a/spec/features/users/show_spec.rb +++ b/spec/features/users/show_spec.rb @@ -33,7 +33,11 @@ visit user_path(@u3) within("#discover") do - expect(page).to have_button("") + 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 From 32012eb53938499b12d0949ceca3ca0cb70b9c94 Mon Sep 17 00:00:00 2001 From: Noelle Hemphill Date: Wed, 11 Oct 2023 10:00:18 -0600 Subject: [PATCH 4/4] test and db: set up tests for the user dashboard and migrate the viewing party table and userviewingparty table --- app/views/users/show.html.erb | 4 +- config/routes.rb | 1 + coverage/.last_run.json | 2 +- coverage/.resultset.json | 5 ++- coverage/index.html | 41 ++++++++++++------- db/migrate/20231010202346_create_users.rb | 2 +- .../20231011154908_create_viewing_parties.rb | 13 ++++++ ...31011155415_create_user_viewing_parties.rb | 11 +++++ db/schema.rb | 25 ++++++++++- spec/features/users/show_spec.rb | 7 ++-- 10 files changed, 86 insertions(+), 25 deletions(-) create mode 100644 db/migrate/20231011154908_create_viewing_parties.rb create mode 100644 db/migrate/20231011155415_create_user_viewing_parties.rb diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index a938271c6..641139a48 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -3,4 +3,6 @@

      Email: <%= @user.email %>

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

      -

      My Viewing Parties

      \ No newline at end of file +

      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 bcfebf332..3b1151b00 100644 --- a/coverage/.last_run.json +++ b/coverage/.last_run.json @@ -1,5 +1,5 @@ { "result": { - "line": 93.33 + "line": 93.44 } } diff --git a/coverage/.resultset.json b/coverage/.resultset.json index bfd3aaf44..99c84cfcd 100644 --- a/coverage/.resultset.json +++ b/coverage/.resultset.json @@ -247,6 +247,7 @@ 1, null, 1, + 1, null ] }, @@ -283,7 +284,7 @@ "lines": [ 1, 1, - 3, + 2, null, null, 1, @@ -310,6 +311,6 @@ ] } }, - "timestamp": 1696992182 + "timestamp": 1697039978 } } diff --git a/coverage/index.html b/coverage/index.html index de959ef35..651cd0f66 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -14,7 +14,7 @@ loading
    • -
      Generated 2023-10-10T20:43:02-06:00
      +
      Generated 2023-10-11T09:59:38-06:00
        @@ -23,14 +23,14 @@

        All Files ( - 93.33% + 93.44% covered at - 0.97 + 0.95 hits/line ) @@ -43,11 +43,11 @@

        - 60 relevant lines, - 56 lines covered and + 61 relevant lines, + 57 lines covered and 4 lines missed. ( - 93.33% + 93.44% )
        @@ -88,7 +88,7 @@

        9 5 4 - 0.78 + 0.67 @@ -238,9 +238,9 @@

        config/routes.rb 100.00 % - 11 - 3 - 3 + 12 + 4 + 4 0 1.00 @@ -398,8 +398,8 @@

        -
      • - 3 +
      • + 2 @@ -3261,8 +3261,8 @@

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

      • -
      • +
      • + 1 + + + + + resources :discover, only: [:index] +
      • +
        + +
        +
      • 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 index a4adaec1c..7c246e232 100644 --- a/spec/features/users/show_spec.rb +++ b/spec/features/users/show_spec.rb @@ -6,9 +6,8 @@ @u2 = User.create!(name: 'Lorien', email: 'lorienlorienl.com') @u3 = User.create!(name: 'Rachel', email: 'rachel@rachel.com') - #leaving these commented out as I haven't figured out the design of this table yet - # @vp1 = @u1.viewingparties.create!(name: "Movie 1", duration: 119, date: "10-31-2023", start_time: "09:00" ) - # @vp2 = @u1.viewingparties.create!(name: "Movie 2", duration: 100, date: "11-13-2023", start_time: "13:00" ) + # @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 @@ -29,7 +28,7 @@ end - it "has a button to take the user to discover movies" do + xit "has a button to take the user to discover movies" do visit user_path(@u3) within("#discover") do