All Files
(
- 93.44%
+ 100.0%
covered at
-
- 0.95
+
+ 1.11
hits/line
)
@@ -39,15 +39,15 @@
- 17 files in total.
+ 19 files in total.
- 61 relevant lines,
- 57 lines covered and
- 4 lines missed.
+ 79 relevant lines,
+ 79 lines covered and
+ 0 lines missed.
(
- 93.44%
+ 100.0%
)
@@ -71,7 +71,7 @@
- app/controllers/application_controller.rb
+ app/helpers/application_helper.rb
100.00 %
4
1
@@ -82,20 +82,9 @@
- app/controllers/users_controller.rb
- 55.56 %
- 18
- 9
- 5
- 4
- 0.67
-
-
-
-
- app/helpers/application_helper.rb
+ app/helpers/landing_page_helper.rb
100.00 %
- 4
+ 2
1
1
0
@@ -104,33 +93,44 @@
- app/helpers/landing_page_helper.rb
+ app/models/application_record.rb
100.00 %
+ 5
+ 2
2
- 1
- 1
0
1.00
- app/models/application_record.rb
+ app/models/user.rb
100.00 %
+ 8
+ 5
5
- 2
- 2
0
1.00
- app/models/user.rb
+ app/models/user_viewing_party.rb
100.00 %
- 2
- 1
- 1
+ 4
+ 3
+ 3
+ 0
+ 1.00
+
+
+
+
+ app/models/viewing_party.rb
+ 100.00 %
+ 7
+ 5
+ 5
0
1.00
@@ -246,6 +246,28 @@
+
+ spec/models/user_viewing_party_spec.rb
+ 100.00 %
+ 8
+ 5
+ 5
+ 0
+ 1.40
+
+
+
+
+ spec/models/viewing_party_spec.rb
+ 100.00 %
+ 17
+ 11
+ 11
+ 0
+ 1.64
+
+
+
spec/spec_helper.rb
100.00 %
@@ -274,9 +296,9 @@
-
+
- app/controllers/application_controller.rb
+ app/helpers/application_helper.rb
100.0%
@@ -329,7 +351,7 @@
- class ApplicationController < ActionController::Base
+ module ApplicationHelper
@@ -349,12 +371,12 @@
-
+
- app/controllers/users_controller.rb
+ app/helpers/landing_page_helper.rb
-
- 55.56%
+
+ 100.0%
lines covered
@@ -363,9 +385,9 @@
- 9 relevant lines.
- 5 lines covered and
- 4 lines missed.
+ 1 relevant lines.
+ 1 lines covered and
+ 0 lines missed.
@@ -382,45 +404,65 @@
- class UsersController < ApplicationController
+ module LandingPageHelper
-
- 1
+
+
- def show
+ end
-
-
- 2
-
+
+
+
-
+
+
+
+ app/models/application_record.rb
+
+
+ 100.0%
+
- @user = User.find(params[:id])
-
-
+ lines covered
+
+
+
+
+
+ 2 relevant lines.
+ 2 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
- -
+
-
-
end
+ # frozen_string_literal: true
- -
+
-
@@ -431,139 +473,148 @@
- -
+
-
1
-
def new
+ class ApplicationRecord < ActiveRecord::Base
- -
-
+
-
+ 1
-
+ primary_abstract_class
- -
+
-
-
end
+ end
-
- -
-
-
-
-
+
+
+
-
-
-
-
-
- 1
-
+
+
+ app/models/user.rb
+
+
+ 100.0%
+
-
+ lines covered
+
- def create
-
-
+
+
+
+ 5 relevant lines.
+ 5 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
- -
-
+
-
+ 1
-
@user = User.new(name: params[:name], email: params[:email])
+ class User < ApplicationRecord
- -
-
+
-
+ 1
-
if @user.save
+ validates_presence_of :name, :email
- -
-
+
-
+ 1
-
redirect_to user_path(@user)
+ validates :email, uniqueness: { case_sensitive: false }
- -
+
-
-
else
+
- -
-
+
-
+ 1
-
render :new
+ has_many :user_viewing_parties
- -
-
+
-
+ 1
-
end
+ has_many :viewing_parties, through: :user_viewing_parties
- -
+
-
-
end
+
- -
+
-
@@ -578,9 +629,9 @@
-
+
- app/helpers/application_helper.rb
+ app/models/user_viewing_party.rb
100.0%
@@ -592,8 +643,8 @@
- 1 relevant lines.
- 1 lines covered and
+ 3 relevant lines.
+ 3 lines covered and
0 lines missed.
@@ -605,24 +656,24 @@
- -
-
+
-
+ 1
-
# frozen_string_literal: true
+ class UserViewingParty < ApplicationRecord
- -
-
+
-
+ 1
-
+ belongs_to :user
@@ -633,7 +684,7 @@
- module ApplicationHelper
+ belongs_to :viewing_party
@@ -653,9 +704,9 @@
-
+
- app/helpers/landing_page_helper.rb
+ app/models/viewing_party.rb
100.0%
@@ -667,8 +718,8 @@
- 1 relevant lines.
- 1 lines covered and
+ 5 relevant lines.
+ 5 lines covered and
0 lines missed.
@@ -686,65 +737,34 @@
- module LandingPageHelper
+ class ViewingParty < ApplicationRecord
- -
-
+
-
+ 1
-
end
+ validates_presence_of :movie_title, :movie_image, :start_time
-
-
-
-
-
-
-
- app/models/application_record.rb
-
-
- 100.0%
-
-
- lines covered
-
-
-
-
-
- 2 relevant lines.
- 2 lines covered and
- 0 lines missed.
-
-
-
-
-
-
-
-
-
- -
-
+
-
+ 1
-
# frozen_string_literal: true
+ validates_numericality_of :movie_id, :duration
- -
+
-
@@ -755,82 +775,29 @@
- -
- 1
-
-
-
-
-
class ApplicationRecord < ActiveRecord::Base
-
-
-
-
- -
+
-
1
-
primary_abstract_class
+ has_many :user_viewing_parties
- -
-
-
-
-
-
-
end
-
-
-
-
-
-
-
-
-
-
- app/models/user.rb
-
-
- 100.0%
-
-
- lines covered
-
-
-
-
-
- 1 relevant lines.
- 1 lines covered and
- 0 lines missed.
-
-
-
-
-
-
-
-
-
-
- -
+
-
1
-
class User < ApplicationRecord
+ has_many :users, through: :user_viewing_parties
- -
+
-
@@ -3401,6 +3368,343 @@
+ end
+
+
+
+
+
+
+
+
+
+
+ spec/models/user_viewing_party_spec.rb
+
+
+ 100.0%
+
+
+ lines covered
+
+
+
+
+
+ 5 relevant lines.
+ 5 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
require 'rails_helper'
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
RSpec.describe UserViewingParty, type: :model do
+
+
+
+
+ -
+ 1
+
+
+
+
+
describe "relationships" do
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should belong_to :user}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should belong_to :viewing_party}
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+
+
+
+
+
+
+ spec/models/viewing_party_spec.rb
+
+
+ 100.0%
+
+
+ lines covered
+
+
+
+
+
+ 11 relevant lines.
+ 11 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
require 'rails_helper'
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
RSpec.describe ViewingParty, type: :model do
+
+
+
+
+ -
+ 1
+
+
+
+
+
describe "validations" do
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_presence_of :movie_title}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_numericality_of :movie_id}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_presence_of :movie_image}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_numericality_of :duration}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_presence_of :start_time}
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
describe "relationships" do
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should have_many :user_viewing_parties}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should have_many(:users).through(:user_viewing_parties)}
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
new file mode 100644
index 000000000..90cffcaaa
--- /dev/null
+++ b/spec/models/user_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+RSpec.describe User, type: :model do
+ describe "validations" do
+ it { should validate_presence_of :name }
+ it { should validate_presence_of :email}
+ it { should validate_uniqueness_of(:email).case_insensitive}
+ end
+
+ describe "relationships" do
+ it { should have_many(:user_viewing_parties) }
+ it { should have_many(:viewing_parties).through(:user_viewing_parties) }
+ end
+
+end
\ No newline at end of file
diff --git a/spec/models/user_viewing_party_spec.rb b/spec/models/user_viewing_party_spec.rb
new file mode 100644
index 000000000..8767c1ff2
--- /dev/null
+++ b/spec/models/user_viewing_party_spec.rb
@@ -0,0 +1,8 @@
+require 'rails_helper'
+
+RSpec.describe UserViewingParty, type: :model do
+ describe "relationships" do
+ it { should belong_to :user}
+ it { should belong_to :viewing_party}
+ end
+end
\ No newline at end of file
diff --git a/spec/models/viewing_party_spec.rb b/spec/models/viewing_party_spec.rb
new file mode 100644
index 000000000..b93db6b89
--- /dev/null
+++ b/spec/models/viewing_party_spec.rb
@@ -0,0 +1,17 @@
+require 'rails_helper'
+
+RSpec.describe ViewingParty, type: :model do
+ describe "validations" do
+ it { should validate_presence_of :movie_title}
+ it { should validate_numericality_of :movie_id}
+ it { should validate_presence_of :movie_image}
+ it { should validate_numericality_of :duration}
+ it { should validate_presence_of :start_time}
+ end
+
+ describe "relationships" do
+ it { should have_many :user_viewing_parties}
+ it { should have_many(:users).through(:user_viewing_parties)}
+ end
+
+end
\ No newline at end of file
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 37775a5bb..b6e000aa4 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -67,12 +67,12 @@
# config.filter_gems_from_backtrace("gem name")
end
-# Shoulda::Matchers.configure do |config|
-# config.integrate do |with|
-# with.test_framework :rspec
-# with.library :rails
-# end
-# end
+Shoulda::Matchers.configure do |config|
+ config.integrate do |with|
+ with.test_framework :rspec
+ with.library :rails
+ end
+end
# VCR.configure do |config|
# config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
# config.hook_into :webmock
- app/controllers/application_controller.rb
+ app/helpers/application_helper.rb
100.00 %
4
1
@@ -82,20 +82,9 @@
- app/controllers/users_controller.rb
- 55.56 %
- 18
- 9
- 5
- 4
- 0.67
-
-
-
-
- app/helpers/application_helper.rb
+ app/helpers/landing_page_helper.rb
100.00 %
- 4
+ 2
1
1
0
@@ -104,33 +93,44 @@
- app/helpers/landing_page_helper.rb
+ app/models/application_record.rb
100.00 %
+ 5
+ 2
2
- 1
- 1
0
1.00
- app/models/application_record.rb
+ app/models/user.rb
100.00 %
+ 8
+ 5
5
- 2
- 2
0
1.00
- app/models/user.rb
+ app/models/user_viewing_party.rb
100.00 %
- 2
- 1
- 1
+ 4
+ 3
+ 3
+ 0
+ 1.00
+
+
+
+
+ app/models/viewing_party.rb
+ 100.00 %
+ 7
+ 5
+ 5
0
1.00
@@ -246,6 +246,28 @@
+
+ spec/models/user_viewing_party_spec.rb
+ 100.00 %
+ 8
+ 5
+ 5
+ 0
+ 1.40
+
+
+
+
+ spec/models/viewing_party_spec.rb
+ 100.00 %
+ 17
+ 11
+ 11
+ 0
+ 1.64
+
+
+
spec/spec_helper.rb
100.00 %
@@ -274,9 +296,9 @@
-
+
- app/controllers/application_controller.rb
+ app/helpers/application_helper.rb
100.0%
@@ -329,7 +351,7 @@
- class ApplicationController < ActionController::Base
+ module ApplicationHelper
@@ -349,12 +371,12 @@
-
+
- app/controllers/users_controller.rb
+ app/helpers/landing_page_helper.rb
-
- 55.56%
+
+ 100.0%
lines covered
@@ -363,9 +385,9 @@
- 9 relevant lines.
- 5 lines covered and
- 4 lines missed.
+ 1 relevant lines.
+ 1 lines covered and
+ 0 lines missed.
@@ -382,45 +404,65 @@
- class UsersController < ApplicationController
+ module LandingPageHelper
-
- 1
+
+
- def show
+ end
-
-
- 2
-
+
+
+
-
+
+
+
+ app/models/application_record.rb
+
+
+ 100.0%
+
- @user = User.find(params[:id])
-
-
+ lines covered
+
+
+
+
+
+ 2 relevant lines.
+ 2 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
- -
+
-
-
end
+ # frozen_string_literal: true
- -
+
-
@@ -431,139 +473,148 @@
- -
+
-
1
-
def new
+ class ApplicationRecord < ActiveRecord::Base
- -
-
+
-
+ 1
-
+ primary_abstract_class
- -
+
-
-
end
+ end
-
- -
-
-
-
-
+
+
+
-
-
-
-
-
- 1
-
+
+
+ app/models/user.rb
+
+
+ 100.0%
+
-
+ lines covered
+
- def create
-
-
+
+
+
+ 5 relevant lines.
+ 5 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
- -
-
+
-
+ 1
-
@user = User.new(name: params[:name], email: params[:email])
+ class User < ApplicationRecord
- -
-
+
-
+ 1
-
if @user.save
+ validates_presence_of :name, :email
- -
-
+
-
+ 1
-
redirect_to user_path(@user)
+ validates :email, uniqueness: { case_sensitive: false }
- -
+
-
-
else
+
- -
-
+
-
+ 1
-
render :new
+ has_many :user_viewing_parties
- -
-
+
-
+ 1
-
end
+ has_many :viewing_parties, through: :user_viewing_parties
- -
+
-
-
end
+
- -
+
-
@@ -578,9 +629,9 @@
-
+
- app/helpers/application_helper.rb
+ app/models/user_viewing_party.rb
100.0%
@@ -592,8 +643,8 @@
- 1 relevant lines.
- 1 lines covered and
+ 3 relevant lines.
+ 3 lines covered and
0 lines missed.
@@ -605,24 +656,24 @@
- -
-
+
-
+ 1
-
# frozen_string_literal: true
+ class UserViewingParty < ApplicationRecord
- -
-
+
-
+ 1
-
+ belongs_to :user
@@ -633,7 +684,7 @@
- module ApplicationHelper
+ belongs_to :viewing_party
@@ -653,9 +704,9 @@
-
+
- app/helpers/landing_page_helper.rb
+ app/models/viewing_party.rb
100.0%
@@ -667,8 +718,8 @@
- 1 relevant lines.
- 1 lines covered and
+ 5 relevant lines.
+ 5 lines covered and
0 lines missed.
@@ -686,65 +737,34 @@
- module LandingPageHelper
+ class ViewingParty < ApplicationRecord
- -
-
+
-
+ 1
-
end
+ validates_presence_of :movie_title, :movie_image, :start_time
-
-
-
-
-
-
-
- app/models/application_record.rb
-
-
- 100.0%
-
-
- lines covered
-
-
-
-
-
- 2 relevant lines.
- 2 lines covered and
- 0 lines missed.
-
-
-
-
-
-
-
-
-
- -
-
+
-
+ 1
-
# frozen_string_literal: true
+ validates_numericality_of :movie_id, :duration
- -
+
-
@@ -755,82 +775,29 @@
- -
- 1
-
-
-
-
-
class ApplicationRecord < ActiveRecord::Base
-
-
-
-
- -
+
-
1
-
primary_abstract_class
+ has_many :user_viewing_parties
- -
-
-
-
-
-
-
end
-
-
-
-
-
-
-
-
-
-
- app/models/user.rb
-
-
- 100.0%
-
-
- lines covered
-
-
-
-
-
- 1 relevant lines.
- 1 lines covered and
- 0 lines missed.
-
-
-
-
-
-
-
-
-
-
- -
+
-
1
-
class User < ApplicationRecord
+ has_many :users, through: :user_viewing_parties
- -
+
-
@@ -3401,6 +3368,343 @@
+ end
+
+
+
+
+
+
+
+
+
+
+ spec/models/user_viewing_party_spec.rb
+
+
+ 100.0%
+
+
+ lines covered
+
+
+
+
+
+ 5 relevant lines.
+ 5 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
require 'rails_helper'
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
RSpec.describe UserViewingParty, type: :model do
+
+
+
+
+ -
+ 1
+
+
+
+
+
describe "relationships" do
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should belong_to :user}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should belong_to :viewing_party}
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+
+
+
+
+
+
+ spec/models/viewing_party_spec.rb
+
+
+ 100.0%
+
+
+ lines covered
+
+
+
+
+
+ 11 relevant lines.
+ 11 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
require 'rails_helper'
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
RSpec.describe ViewingParty, type: :model do
+
+
+
+
+ -
+ 1
+
+
+
+
+
describe "validations" do
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_presence_of :movie_title}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_numericality_of :movie_id}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_presence_of :movie_image}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_numericality_of :duration}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_presence_of :start_time}
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
describe "relationships" do
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should have_many :user_viewing_parties}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should have_many(:users).through(:user_viewing_parties)}
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
new file mode 100644
index 000000000..90cffcaaa
--- /dev/null
+++ b/spec/models/user_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+RSpec.describe User, type: :model do
+ describe "validations" do
+ it { should validate_presence_of :name }
+ it { should validate_presence_of :email}
+ it { should validate_uniqueness_of(:email).case_insensitive}
+ end
+
+ describe "relationships" do
+ it { should have_many(:user_viewing_parties) }
+ it { should have_many(:viewing_parties).through(:user_viewing_parties) }
+ end
+
+end
\ No newline at end of file
diff --git a/spec/models/user_viewing_party_spec.rb b/spec/models/user_viewing_party_spec.rb
new file mode 100644
index 000000000..8767c1ff2
--- /dev/null
+++ b/spec/models/user_viewing_party_spec.rb
@@ -0,0 +1,8 @@
+require 'rails_helper'
+
+RSpec.describe UserViewingParty, type: :model do
+ describe "relationships" do
+ it { should belong_to :user}
+ it { should belong_to :viewing_party}
+ end
+end
\ No newline at end of file
diff --git a/spec/models/viewing_party_spec.rb b/spec/models/viewing_party_spec.rb
new file mode 100644
index 000000000..b93db6b89
--- /dev/null
+++ b/spec/models/viewing_party_spec.rb
@@ -0,0 +1,17 @@
+require 'rails_helper'
+
+RSpec.describe ViewingParty, type: :model do
+ describe "validations" do
+ it { should validate_presence_of :movie_title}
+ it { should validate_numericality_of :movie_id}
+ it { should validate_presence_of :movie_image}
+ it { should validate_numericality_of :duration}
+ it { should validate_presence_of :start_time}
+ end
+
+ describe "relationships" do
+ it { should have_many :user_viewing_parties}
+ it { should have_many(:users).through(:user_viewing_parties)}
+ end
+
+end
\ No newline at end of file
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 37775a5bb..b6e000aa4 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -67,12 +67,12 @@
# config.filter_gems_from_backtrace("gem name")
end
-# Shoulda::Matchers.configure do |config|
-# config.integrate do |with|
-# with.test_framework :rspec
-# with.library :rails
-# end
-# end
+Shoulda::Matchers.configure do |config|
+ config.integrate do |with|
+ with.test_framework :rspec
+ with.library :rails
+ end
+end
# VCR.configure do |config|
# config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
# config.hook_into :webmock
-
+
- app/controllers/application_controller.rb
+ app/helpers/application_helper.rb
100.0%
@@ -329,7 +351,7 @@
- class ApplicationController < ActionController::Base
+ module ApplicationHelper
@@ -349,12 +371,12 @@
-
+
- app/controllers/users_controller.rb
+ app/helpers/landing_page_helper.rb
-
- 55.56%
+
+ 100.0%
lines covered
@@ -363,9 +385,9 @@
- 9 relevant lines.
- 5 lines covered and
- 4 lines missed.
+ 1 relevant lines.
+ 1 lines covered and
+ 0 lines missed.
@@ -382,45 +404,65 @@
- class UsersController < ApplicationController
+ module LandingPageHelper
-
- 1
+
+
- def show
+ end
-
-
- 2
-
+
+
+
-
+
+
+
+ app/models/application_record.rb
+
+
+ 100.0%
+
- @user = User.find(params[:id])
-
-
+ lines covered
+
+
+
+
+
+ 2 relevant lines.
+ 2 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
- -
+
-
-
end
+ # frozen_string_literal: true
- -
+
-
@@ -431,139 +473,148 @@
- -
+
-
1
-
def new
+ class ApplicationRecord < ActiveRecord::Base
- -
-
+
-
+ 1
-
+ primary_abstract_class
- -
+
-
-
end
+ end
-
- -
-
-
-
-
+
+
+
-
-
-
-
-
- 1
-
+
+
+ app/models/user.rb
+
+
+ 100.0%
+
-
+ lines covered
+
- def create
-
-
+
+
+
+ 5 relevant lines.
+ 5 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
- -
-
+
-
+ 1
-
@user = User.new(name: params[:name], email: params[:email])
+ class User < ApplicationRecord
- -
-
+
-
+ 1
-
if @user.save
+ validates_presence_of :name, :email
- -
-
+
-
+ 1
-
redirect_to user_path(@user)
+ validates :email, uniqueness: { case_sensitive: false }
- -
+
-
-
else
+
- -
-
+
-
+ 1
-
render :new
+ has_many :user_viewing_parties
- -
-
+
-
+ 1
-
end
+ has_many :viewing_parties, through: :user_viewing_parties
- -
+
-
-
end
+
- -
+
-
@@ -578,9 +629,9 @@
-
+
- app/helpers/application_helper.rb
+ app/models/user_viewing_party.rb
100.0%
@@ -592,8 +643,8 @@
- 1 relevant lines.
- 1 lines covered and
+ 3 relevant lines.
+ 3 lines covered and
0 lines missed.
@@ -605,24 +656,24 @@
- -
-
+
-
+ 1
-
# frozen_string_literal: true
+ class UserViewingParty < ApplicationRecord
- -
-
+
-
+ 1
-
+ belongs_to :user
@@ -633,7 +684,7 @@
- module ApplicationHelper
+ belongs_to :viewing_party
@@ -653,9 +704,9 @@
-
+
- app/helpers/landing_page_helper.rb
+ app/models/viewing_party.rb
100.0%
@@ -667,8 +718,8 @@
- 1 relevant lines.
- 1 lines covered and
+ 5 relevant lines.
+ 5 lines covered and
0 lines missed.
@@ -686,65 +737,34 @@
- module LandingPageHelper
+ class ViewingParty < ApplicationRecord
- -
-
+
-
+ 1
-
end
+ validates_presence_of :movie_title, :movie_image, :start_time
-
-
-
-
-
-
-
- app/models/application_record.rb
-
-
- 100.0%
-
-
- lines covered
-
-
-
-
-
- 2 relevant lines.
- 2 lines covered and
- 0 lines missed.
-
-
-
-
-
-
-
-
-
- -
-
+
-
+ 1
-
# frozen_string_literal: true
+ validates_numericality_of :movie_id, :duration
- -
+
-
@@ -755,82 +775,29 @@
- -
- 1
-
-
-
-
-
class ApplicationRecord < ActiveRecord::Base
-
-
-
-
- -
+
-
1
-
primary_abstract_class
+ has_many :user_viewing_parties
- -
-
-
-
-
-
-
end
-
-
-
-
-
-
-
-
-
-
- app/models/user.rb
-
-
- 100.0%
-
-
- lines covered
-
-
-
-
-
- 1 relevant lines.
- 1 lines covered and
- 0 lines missed.
-
-
-
-
-
-
-
-
-
-
- -
+
-
1
-
class User < ApplicationRecord
+ has_many :users, through: :user_viewing_parties
- -
+
-
@@ -3401,6 +3368,343 @@
+ end
+
+
+
+
+
+
+
+
+
+
+ spec/models/user_viewing_party_spec.rb
+
+
+ 100.0%
+
+
+ lines covered
+
+
+
+
+
+ 5 relevant lines.
+ 5 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
require 'rails_helper'
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
RSpec.describe UserViewingParty, type: :model do
+
+
+
+
+ -
+ 1
+
+
+
+
+
describe "relationships" do
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should belong_to :user}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should belong_to :viewing_party}
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+
+
+
+
+
+
+ spec/models/viewing_party_spec.rb
+
+
+ 100.0%
+
+
+ lines covered
+
+
+
+
+
+ 11 relevant lines.
+ 11 lines covered and
+ 0 lines missed.
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
require 'rails_helper'
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
RSpec.describe ViewingParty, type: :model do
+
+
+
+
+ -
+ 1
+
+
+
+
+
describe "validations" do
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_presence_of :movie_title}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_numericality_of :movie_id}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_presence_of :movie_image}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_numericality_of :duration}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should validate_presence_of :start_time}
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+ 1
+
+
+
+
+
describe "relationships" do
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should have_many :user_viewing_parties}
+
+
+
+
+ -
+ 2
+
+
+
+
+
it { should have_many(:users).through(:user_viewing_parties)}
+
+
+
+
+ -
+
+
+
+
+
+
end
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
new file mode 100644
index 000000000..90cffcaaa
--- /dev/null
+++ b/spec/models/user_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+RSpec.describe User, type: :model do
+ describe "validations" do
+ it { should validate_presence_of :name }
+ it { should validate_presence_of :email}
+ it { should validate_uniqueness_of(:email).case_insensitive}
+ end
+
+ describe "relationships" do
+ it { should have_many(:user_viewing_parties) }
+ it { should have_many(:viewing_parties).through(:user_viewing_parties) }
+ end
+
+end
\ No newline at end of file
diff --git a/spec/models/user_viewing_party_spec.rb b/spec/models/user_viewing_party_spec.rb
new file mode 100644
index 000000000..8767c1ff2
--- /dev/null
+++ b/spec/models/user_viewing_party_spec.rb
@@ -0,0 +1,8 @@
+require 'rails_helper'
+
+RSpec.describe UserViewingParty, type: :model do
+ describe "relationships" do
+ it { should belong_to :user}
+ it { should belong_to :viewing_party}
+ end
+end
\ No newline at end of file
diff --git a/spec/models/viewing_party_spec.rb b/spec/models/viewing_party_spec.rb
new file mode 100644
index 000000000..b93db6b89
--- /dev/null
+++ b/spec/models/viewing_party_spec.rb
@@ -0,0 +1,17 @@
+require 'rails_helper'
+
+RSpec.describe ViewingParty, type: :model do
+ describe "validations" do
+ it { should validate_presence_of :movie_title}
+ it { should validate_numericality_of :movie_id}
+ it { should validate_presence_of :movie_image}
+ it { should validate_numericality_of :duration}
+ it { should validate_presence_of :start_time}
+ end
+
+ describe "relationships" do
+ it { should have_many :user_viewing_parties}
+ it { should have_many(:users).through(:user_viewing_parties)}
+ end
+
+end
\ No newline at end of file
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 37775a5bb..b6e000aa4 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -67,12 +67,12 @@
# config.filter_gems_from_backtrace("gem name")
end
-# Shoulda::Matchers.configure do |config|
-# config.integrate do |with|
-# with.test_framework :rspec
-# with.library :rails
-# end
-# end
+Shoulda::Matchers.configure do |config|
+ config.integrate do |with|
+ with.test_framework :rspec
+ with.library :rails
+ end
+end
# VCR.configure do |config|
# config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
# config.hook_into :webmock
app/controllers/application_controller.rb
+app/helpers/application_helper.rb
100.0%
@@ -329,7 +351,7 @@
- class ApplicationController < ActionController::Base
+ module ApplicationHelper
class ApplicationController < ActionController::Base
+ module ApplicationHelper
app/controllers/users_controller.rb
+app/helpers/landing_page_helper.rb
-
- 55.56%
+
+ 100.0%
lines covered
@@ -363,9 +385,9 @@
- 9 relevant lines.
- 5 lines covered and
- 4 lines missed.
+ 1 relevant lines.
+ 1 lines covered and
+ 0 lines missed.
@@ -382,45 +404,65 @@
- class UsersController < ApplicationController
+ module LandingPageHelper
- class UsersController < ApplicationController
+ module LandingPageHelper
def show
+ end
app/models/application_record.rb
+
+
+ 100.0%
+
- @user = User.find(params[:id])
-
-
+
-- +
- -
end
+# frozen_string_literal: true
-- +
- @@ -431,139 +473,148 @@
-- +
- 1 -
def new
+class ApplicationRecord < ActiveRecord::Base
-- - +
- + 1 -
+
primary_abstract_class
--- +
- -
end
+end
--- - - - - + + +
- -
app/models/user.rb
++ + 100.0% + - + lines covered +
- def create
-
- +
-- - +
- + 1 -
@user = User.new(name: params[:name], email: params[:email])
+class User < ApplicationRecord
-- - +
- + 1 -
if @user.save
+validates_presence_of :name, :email
-- - +
- + 1 -
redirect_to user_path(@user)
+validates :email, uniqueness: { case_sensitive: false }
-- +
- -
else
+
-- - +
- + 1 -
render :new
+has_many :user_viewing_parties
-- - +
- + 1 -
end
+has_many :viewing_parties, through: :user_viewing_parties
-- +
- -
end
+
--- +
- @@ -578,9 +629,9 @@
+--@@ -653,9 +704,9 @@app/helpers/application_helper.rb
+app/models/user_viewing_party.rb
100.0% @@ -592,8 +643,8 @@
- 1 relevant lines. - 1 lines covered and + 3 relevant lines. + 3 lines covered and 0 lines missed.@@ -605,24 +656,24 @@
-- - +
- + 1 -
# frozen_string_literal: true
+class UserViewingParty < ApplicationRecord
-@@ -633,7 +684,7 @@- - +
- + 1 -
+
belongs_to :user
-
module ApplicationHelper
+belongs_to :viewing_party
+- - --app/helpers/landing_page_helper.rb
+app/models/viewing_party.rb
100.0% @@ -667,8 +718,8 @@
- 1 relevant lines. - 1 lines covered and + 5 relevant lines. + 5 lines covered and 0 lines missed.@@ -686,65 +737,34 @@-
module LandingPageHelper
+class ViewingParty < ApplicationRecord
-- - -- - +
- + 1 -
end
+validates_presence_of :movie_title, :movie_image, :start_time
-- - --- -app/models/application_record.rb
-- - 100.0% - - - lines covered -
- - - -- 2 relevant lines. - 2 lines covered and - 0 lines missed. -- - - ----
--- - +
- + 1 -
# frozen_string_literal: true
+validates_numericality_of :movie_id, :duration
-- +
- @@ -755,82 +775,29 @@
-- -- - 1 - - - - -
-class ApplicationRecord < ActiveRecord::Base
--- +
- 1 -
primary_abstract_class
+has_many :user_viewing_parties
-- -- - - - - - -
-end
--+ + +-- -app/models/user.rb
-- - 100.0% - - - lines covered -
- - - -- 1 relevant lines. - 1 lines covered and - 0 lines missed. -- - - --+- -
+-- +
- 1 -
class User < ApplicationRecord
+has_many :users, through: :user_viewing_parties
-+ +- +
- @@ -3401,6 +3368,343 @@
++
end
+++ + +++ +spec/models/user_viewing_party_spec.rb
++ + 100.0% + + + lines covered +
+ + + ++ 5 relevant lines. + 5 lines covered and + 0 lines missed. ++ + + ++++ +
+++ +- + 1 + + + + +
+require 'rails_helper'
+++ +- + + + + + +
++
++ +- + 1 + + + + +
+RSpec.describe UserViewingParty, type: :model do
+++ +- + 1 + + + + +
+describe "relationships" do
+++ +- + 2 + + + + +
+it { should belong_to :user}
+++ +- + 2 + + + + +
+it { should belong_to :viewing_party}
+++ +- + + + + + +
+end
+++ +- + + + + + +
+end
++++ +spec/models/viewing_party_spec.rb
++ + 100.0% + + + lines covered +
+ + + ++ 11 relevant lines. + 11 lines covered and + 0 lines missed. ++ + + +++ +
++ +- + 1 + + + + +
+require 'rails_helper'
+++ +- + + + + + +
++
++ +- + 1 + + + + +
+RSpec.describe ViewingParty, type: :model do
+++ +- + 1 + + + + +
+describe "validations" do
+++ +- + 2 + + + + +
+it { should validate_presence_of :movie_title}
+++ +- + 2 + + + + +
+it { should validate_numericality_of :movie_id}
+++ +- + 2 + + + + +
+it { should validate_presence_of :movie_image}
+++ +- + 2 + + + + +
+it { should validate_numericality_of :duration}
+++ +- + 2 + + + + +
+it { should validate_presence_of :start_time}
+++ +- + + + + + +
+end
+++ +- + + + + + +
++
++ +- + 1 + + + + +
+describe "relationships" do
+++ +- + 2 + + + + +
+it { should have_many :user_viewing_parties}
+++ +- + 2 + + + + +
+it { should have_many(:users).through(:user_viewing_parties)}
+++ +- + + + + + +
+end
+++ +- + + + + + +
++
+diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 000000000..90cffcaaa --- /dev/null +++ b/spec/models/user_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +RSpec.describe User, type: :model do + describe "validations" do + it { should validate_presence_of :name } + it { should validate_presence_of :email} + it { should validate_uniqueness_of(:email).case_insensitive} + end + + describe "relationships" do + it { should have_many(:user_viewing_parties) } + it { should have_many(:viewing_parties).through(:user_viewing_parties) } + end + +end \ No newline at end of file diff --git a/spec/models/user_viewing_party_spec.rb b/spec/models/user_viewing_party_spec.rb new file mode 100644 index 000000000..8767c1ff2 --- /dev/null +++ b/spec/models/user_viewing_party_spec.rb @@ -0,0 +1,8 @@ +require 'rails_helper' + +RSpec.describe UserViewingParty, type: :model do + describe "relationships" do + it { should belong_to :user} + it { should belong_to :viewing_party} + end +end \ No newline at end of file diff --git a/spec/models/viewing_party_spec.rb b/spec/models/viewing_party_spec.rb new file mode 100644 index 000000000..b93db6b89 --- /dev/null +++ b/spec/models/viewing_party_spec.rb @@ -0,0 +1,17 @@ +require 'rails_helper' + +RSpec.describe ViewingParty, type: :model do + describe "validations" do + it { should validate_presence_of :movie_title} + it { should validate_numericality_of :movie_id} + it { should validate_presence_of :movie_image} + it { should validate_numericality_of :duration} + it { should validate_presence_of :start_time} + end + + describe "relationships" do + it { should have_many :user_viewing_parties} + it { should have_many(:users).through(:user_viewing_parties)} + end + +end \ No newline at end of file diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 37775a5bb..b6e000aa4 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -67,12 +67,12 @@ # config.filter_gems_from_backtrace("gem name") end -# Shoulda::Matchers.configure do |config| -# config.integrate do |with| -# with.test_framework :rspec -# with.library :rails -# end -# end +Shoulda::Matchers.configure do |config| + config.integrate do |with| + with.test_framework :rspec + with.library :rails + end +end # VCR.configure do |config| # config.cassette_library_dir = 'spec/fixtures/vcr_cassettes' # config.hook_into :webmock- + + + + +
end