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
-
-
-
-
-
class LandingPageController < ApplicationController
-
-
-
-
- -
- 1
-
-
-
-
-
def index
-
-
-
-
- -
- 2
-
-
-
-
-
@users = User.all
-
-
-
-
- -
-
-
-
-
-
-
end
-
-
-
-
- -
-
-
-
-
-
-
end
-
-
-
-
-
-
-
-
-
+
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
- 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
-
-
-
-
-
class LandingPageController < ApplicationController
-
-
-
-
- -
- 1
-
-
-
-
-
def index
-
-
-
-
- -
- 2
-
-
-
-
-
@users = User.all
-
-
-
-
- -
-
-
-
-
-
-
end
-
-
-
-
- -
-
-
-
-
-
-
end
-
-
-
-
-
-
-
-
-
+
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
-
+
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
-
-
-
-
-
class LandingPageController < ApplicationController
-
-
-
-
- -
- 1
-
-
-
-
-
def index
-
-
-
-
- -
- 2
-
-
-
-
-
@users = User.all
-
-
-
-
- -
-
-
-
-
-
-
end
-
-
-
-
- -
-
-
-
-
-
-
end
-
-
-
-
-
-
-
-
-
+
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
app/controllers/application_controller.rb
@@ -360,93 +349,7 @@
app/controllers/landing_page_controller.rb
-- - 100.0% - - - lines covered -
- - - ---- -
--- -- - 1 - - - - -
-class LandingPageController < ApplicationController
--- -- - 1 - - - - -
-def index
--- -- - 2 - - - - -
-@users = User.all
--- -- - - - - - -
-end
--- -- - - - - - -
-end
-
app/controllers/users_controller.rb
@@ -495,8 +398,8 @@
- @user = User.new(name: params[:user][:name], email: params[:user][:email])
+ @user = User.new(name: params[:name], email: params[:email])
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 @@
resources :discover, only: [:index]
+