@@ -53,9 +53,9 @@
app/models/episode.rb |
100.0 % |
- 7 |
- 5 |
- 5 |
+ 8 |
+ 6 |
+ 6 |
0 |
1.0 |
@@ -107,17 +107,17 @@
4 |
4 |
0 |
- 1.5 |
+ 1.0 |
spec/models/season_spec.rb |
- 100.0 % |
+ 85.71 % |
13 |
7 |
- 7 |
- 0 |
- 1.4 |
+ 6 |
+ 1 |
+ 0.9 |
@@ -127,7 +127,7 @@
4 |
4 |
0 |
- 1.5 |
+ 1.0 |
@@ -137,7 +137,7 @@
7 |
7 |
0 |
- 1.7 |
+ 1.0 |
@@ -147,7 +147,7 @@
6 |
6 |
0 |
- 1.7 |
+ 1.0 |
@@ -171,8 +171,8 @@
app/models/episode.rb
100.0 % covered
- 5 relevant lines.
- 5 lines covered and
+ 6 relevant lines.
+ 6 lines covered and
0 lines missed.
@@ -216,7 +216,13 @@ 100.0 % covered
validates :release_date, presence: true
-
+
+ 1
+
+ validates :summary, presence: true
+
+
+
end
@@ -473,14 +479,14 @@ 100.0 % covered
RSpec.describe Favorite, type: :model do
-
- 2
+
+ 1
it { should belong_to :series_list }
-
- 2
+
+ 1
it { should belong_to :series }
@@ -499,11 +505,11 @@ 100.0 % covered
@@ -528,8 +534,8 @@
100.0 % covered
RSpec.describe Season, type: :model do
-
- 2
+
+ 1
it { should belong_to :series }
@@ -540,14 +546,14 @@ 100.0 % covered
-
- 2
+
+ 1
it { should validate_presence_of :name }
-
- 2
+
+ 1
it { should validate_presence_of :number }
@@ -564,8 +570,8 @@ 100.0 % covered
it do
-
- 1
+
+
should validate_numericality_of(:number).
@@ -625,14 +631,14 @@ 100.0 % covered
RSpec.describe SeriesList, type: :model do
-
- 2
+
+ 1
it { should have_one :user }
-
- 2
+
+ 1
it { should have_many :series }
@@ -680,26 +686,26 @@ 100.0 % covered
RSpec.describe Series, type: :model do
-
- 2
+
+ 1
it { should validate_presence_of :title }
-
- 2
+
+ 1
it { should validate_presence_of :description }
-
- 2
+
+ 1
it { should validate_presence_of :year }
-
- 2
+
+ 1
it { should validate_presence_of :image_path }
@@ -710,8 +716,8 @@ 100.0 % covered
-
- 2
+
+ 1
it { should have_many :seasons }
@@ -759,8 +765,8 @@ 100.0 % covered
RSpec.describe User, type: :model do
-
- 2
+
+ 1
it { should belong_to :series_list }
@@ -771,20 +777,20 @@ 100.0 % covered
-
- 2
+
+ 1
it { should validate_presence_of :name }
-
- 2
+
+ 1
it { should validate_presence_of :email }
-
- 2
+
+ 1
it { should validate_presence_of :password }
diff --git a/db/migrate/20171127204416_add_episode_season_to_episode.rb b/db/migrate/20171127204416_add_episode_season_to_episode.rb
new file mode 100644
index 0000000..faeea56
--- /dev/null
+++ b/db/migrate/20171127204416_add_episode_season_to_episode.rb
@@ -0,0 +1,6 @@
+class AddEpisodeSeasonToEpisode < ActiveRecord::Migration[5.0]
+ def change
+ add_column :episodes, :episode_season, :string
+ add_column :episodes, :summary, :text
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index bcb0bb7..b5f2315 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20171127203309) do
+ActiveRecord::Schema.define(version: 20171127204416) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -19,9 +19,11 @@
t.string "name"
t.integer "number"
t.date "release_date"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.integer "season_id"
+ t.string "episode_season"
+ t.text "summary"
t.index ["season_id"], name: "index_episodes_on_season_id", using: :btree
end
diff --git a/db/seeds.rb b/db/seeds.rb
index 4a9526e..c2ff79b 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -1,36 +1,69 @@
+Episode.destroy_all
+Season.destroy_all
Series.destroy_all
-Series.create(
+supergirl = Series.create(
title: "Supergirl",
description: "Twenty-four-year-old Kara Zor-El, who was taken in by the Danvers family when she was 13 after being sent away from Krypton, must learn to embrace her powers after previously hiding them. The Danvers teach her to be careful with her powers, until she has to reveal them during an unexpected disaster, setting her on her journey of heroism.",
year: "2015",
image_path: "https://static.next-episode.net/tv-shows-images/huge/supergirl.jpg"
)
-Series.create(
+Episode.create(
+ name: "Crisis on Earth-X (Part 1)",
+ number: 8,
+ release_date: "2017-11-27",
+ season: Season.create(name: "3ª temporada", number: 3, series: supergirl),
+ summary: "Barry and Iris’s wedding brings the gang together, but things go awry when villains from Earth-X attack the ceremony. All of the superheroes band together with help from their super friends like Citizen Cold, The Ray, Felicity Smoak, Iris West and Alex Danvers to take on their most formidable villains yet. Earth’s mightiest heroes – Green Arrow, Supergirl, The Flash and White Canary – lead their teams into battle to save the world."
+)
+
+##
+
+arrow = Series.create(
title: "Arrow",
description: "Arrow is a modern retelling of the adventures of legendary DC hero Green Arrow.",
year: "2012",
image_path: "https://static.next-episode.net/tv-shows-images/huge/arrow.jpg"
)
-Series.create(
+Episode.create(
+ name: "Crisis on Earth-X (Part 2)",
+ number: 8,
+ release_date: "2017-11-27",
+ season: Season.create(name: "6ª temporada", number: 6, series: arrow),
+ summary: "Barry and Iris’s wedding brings the gang together, but things go awry when villains from Earth-X attack the ceremony. All of the superheroes band together with help from their super friends like Citizen Cold, The Ray, Felicity Smoak, Iris West and Alex Danvers to take on their most formidable villains yet. Earth’s mightiest heroes – Green Arrow, Supergirl, The Flash and White Canary – lead their teams into battle to save the world."
+)
+
+##
+
+the_good_doctor = Series.create(
title: "The Good Doctor",
description: "The Good Doctor centers on a young surgeon with Savant Syndrome who is recruited into the pediatric surgical unit of a prestigious hospital. The question will arise - can a person who doesn't have the ability to relate to people actually save their lives?",
year: "2017",
image_path: "https://static.next-episode.net/tv-shows-images/huge/the-good-doctor.jpg"
)
-Series.create(
- title: "The Flash",
- description: "The show centers around scientist Barry Allen, who suffers a freak accident that turns him into a superhero with the power of incredible speed. This version of The Flash started with a recurring character on Arrow.",
- year: "2014",
- image_path: "https://static.next-episode.net/tv-shows-images/huge/the-flash.jpg"
+Episode.create(
+ name: "Intangibles",
+ number: 9,
+ release_date: "2017-11-27",
+ season: Season.create(name: "1ª temporada", number: 1, series: the_good_doctor),
+ summary: "As part of St. Bonaventure hospital's international humanitarian program, the team takes on the case of a young boy from the Congo who has severe congenital heart anomalies. Dr. Neil Melendez has doubts about the safety of the procedure, while Dr. Shaun Murphy works out the best course of action. Meanwhile, Murphy's latest encounter with his neighbor Lea has him confused."
)
-Series.create(
+##
+
+the_flash = Series.create(
title: "The Flash",
description: "The show centers around scientist Barry Allen, who suffers a freak accident that turns him into a superhero with the power of incredible speed. This version of The Flash started with a recurring character on Arrow.",
year: "2014",
image_path: "https://static.next-episode.net/tv-shows-images/huge/the-flash.jpg"
+)
+
+Episode.create(
+ name: "Crisis on Earth X, Part 3",
+ number: 8,
+ release_date: "2017-11-28",
+ season: Season.create(name: "4ª temporada", number: 4, series: the_flash),
+ summary: "Barry and Iris's wedding brings the gang together, but things go awry when villains from Earth-X attack the ceremony. All of the superheroes band together with help from their super friends like Citizen Cold, The Ray, Felicity Smoak, Iris West and Alex Danvers to take on their most formidable villains yet. Earth's mightiest heroes – Green Arrow, Supergirl, The Flash and White Canary – lead their teams into battle to save the world."
)
\ No newline at end of file
diff --git a/spec/models/episode_spec.rb b/spec/models/episode_spec.rb
index 77cdee9..bb5fd28 100644
--- a/spec/models/episode_spec.rb
+++ b/spec/models/episode_spec.rb
@@ -6,6 +6,7 @@
it { should validate_presence_of :name }
it { should validate_presence_of :number }
it { should validate_presence_of :release_date }
+ it { should validate_presence_of :summary }
it do
should validate_numericality_of(:number).
diff --git a/spec/models/season_spec.rb b/spec/models/season_spec.rb
index d089f8c..780b33a 100644
--- a/spec/models/season_spec.rb
+++ b/spec/models/season_spec.rb
@@ -2,6 +2,7 @@
RSpec.describe Season, type: :model do
it { should belong_to :series }
+ it { should have_many :episodes }
it { should validate_presence_of :name }
it { should validate_presence_of :number }