Skip to content
This repository was archived by the owner on Sep 24, 2019. It is now read-only.

Commit bb80de9

Browse files
authored
Merge pull request #15 from GraphQLAcademy/add-film
Add Film model and fixtures
2 parents dfc6c94 + aa9582a commit bb80de9

5 files changed

Lines changed: 145 additions & 1 deletion

File tree

app/models/film.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Film < ApplicationRecord
2+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class CreateFilms < ActiveRecord::Migration[5.0]
2+
def change
3+
create_table :films do |t|
4+
t.string :title
5+
t.integer :episode_id
6+
t.string :opening_crawl
7+
t.string :director
8+
t.string :producer
9+
t.date :release_date
10+
t.timestamps
11+
end
12+
end
13+
end

db/schema.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 20170210214836) do
13+
ActiveRecord::Schema.define(version: 20170210220945) do
14+
15+
create_table "films", force: :cascade do |t|
16+
t.string "title"
17+
t.integer "episode_id"
18+
t.string "opening_crawl"
19+
t.string "director"
20+
t.string "producer"
21+
t.date "release_date"
22+
t.datetime "created_at", null: false
23+
t.datetime "updated_at", null: false
24+
end
1425

1526
create_table "people", force: :cascade do |t|
1627
t.string "name"

test/fixtures/films.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
a-new-hope:
2+
title: A New Hope
3+
episode_id: 4
4+
opening_crawl: "It is a period of civil war.\r\nRebel spaceships, striking\r\nfrom
5+
a hidden base, have won\r\ntheir first victory against\r\nthe evil Galactic
6+
Empire.\r\n\r\nDuring the battle, Rebel\r\nspies managed to steal secret\r\nplans
7+
to the Empire's\r\nultimate weapon, the DEATH\r\nSTAR, an armored space\r\nstation
8+
with enough power\r\nto destroy an entire planet.\r\n\r\nPursued by the Empire's\r\nsinister
9+
agents, Princess\r\nLeia races home aboard her\r\nstarship, custodian of the\r\nstolen
10+
plans that can save her\r\npeople and restore\r\nfreedom to the galaxy...."
11+
director: George Lucas
12+
producer: Gary Kurtz, Rick McCallum
13+
release_date: '1977-05-25'
14+
created_at: '2014-12-10T14:23:31.880000Z'
15+
updated_at: '2015-04-11T09:46:52.774897Z'
16+
17+
attack-of-the-clones:
18+
title: Attack of the Clones
19+
episode_id: 2
20+
opening_crawl: "There is unrest in the Galactic\r\nSenate. Several thousand solar\r\nsystems
21+
have declared their\r\nintentions to leave the Republic.\r\n\r\nThis separatist
22+
movement,\r\nunder the leadership of the\r\nmysterious Count Dooku, has\r\nmade
23+
it difficult for the limited\r\nnumber of Jedi Knights to maintain \r\npeace
24+
and order in the galaxy.\r\n\r\nSenator Amidala, the former\r\nQueen of Naboo,
25+
is returning\r\nto the Galactic Senate to vote\r\non the critical issue of creating\r\nan
26+
ARMY OF THE REPUBLIC\r\nto assist the overwhelmed\r\nJedi...."
27+
director: George Lucas
28+
producer: Rick McCallum
29+
release_date: '2002-05-16'
30+
created_at: '2014-12-20T10:57:57.886000Z'
31+
updated_at: '2015-04-11T09:45:01.623982Z'
32+
33+
the-phantom-menace:
34+
title: The Phantom Menace
35+
episode_id: 1
36+
opening_crawl: "Turmoil has engulfed the\r\nGalactic Republic. The taxation\r\nof
37+
trade routes to outlying star\r\nsystems is in dispute.\r\n\r\nHoping to resolve
38+
the matter\r\nwith a blockade of deadly\r\nbattleships, the greedy Trade\r\nFederation
39+
has stopped all\r\nshipping to the small planet\r\nof Naboo.\r\n\r\nWhile the
40+
Congress of the\r\nRepublic endlessly debates\r\nthis alarming chain of events,\r\nthe
41+
Supreme Chancellor has\r\nsecretly dispatched two Jedi\r\nKnights, the guardians
42+
of\r\npeace and justice in the\r\ngalaxy, to settle the conflict...."
43+
director: George Lucas
44+
producer: Rick McCallum
45+
release_date: '1999-05-19'
46+
created_at: '2014-12-19T16:52:55.740000Z'
47+
updated_at: '2015-04-11T09:45:18.689301Z'
48+
49+
revenge-of-the-sith:
50+
title: Revenge of the Sith
51+
episode_id: 3
52+
opening_crawl: "War! The Republic is crumbling\r\nunder attacks by the ruthless\r\nSith
53+
Lord, Count Dooku.\r\nThere are heroes on both sides.\r\nEvil is everywhere.\r\n\r\nIn
54+
a stunning move, the\r\nfiendish droid leader, General\r\nGrievous, has swept
55+
into the\r\nRepublic capital and kidnapped\r\nChancellor Palpatine, leader of\r\nthe
56+
Galactic Senate.\r\n\r\nAs the Separatist Droid Army\r\nattempts to flee the
57+
besieged\r\ncapital with their valuable\r\nhostage, two Jedi Knights lead a\r\ndesperate
58+
mission to rescue the\r\ncaptive Chancellor...."
59+
director: George Lucas
60+
producer: Rick McCallum
61+
release_date: '2005-05-19'
62+
created_at: '2014-12-20T18:49:38.403000Z'
63+
updated_at: '2015-04-11T09:45:44.862122Z'
64+
65+
return-of-the-jedi:
66+
title: Return of the Jedi
67+
episode_id: 6
68+
opening_crawl: "Luke Skywalker has returned to\r\nhis home planet of Tatooine
69+
in\r\nan attempt to rescue his\r\nfriend Han Solo from the\r\nclutches of the
70+
vile gangster\r\nJabba the Hutt.\r\n\r\nLittle does Luke know that the\r\nGALACTIC
71+
EMPIRE has secretly\r\nbegun construction on a new\r\narmored space station
72+
even\r\nmore powerful than the first\r\ndreaded Death Star.\r\n\r\nWhen completed,
73+
this ultimate\r\nweapon will spell certain doom\r\nfor the small band of rebels\r\nstruggling
74+
to restore freedom\r\nto the galaxy..."
75+
director: Richard Marquand
76+
producer: Howard G. Kazanjian, George Lucas, Rick McCallum
77+
release_date: '1983-05-25'
78+
created_at: '2014-12-18T10:39:33.255000Z'
79+
updated_at: '2015-04-11T09:46:05.220365Z'
80+
81+
the-empire-strikes-back:
82+
title: The Empire Strikes Back
83+
episode_id: 5
84+
opening_crawl: "It is a dark time for the\r\nRebellion. Although the Death\r\nStar
85+
has been destroyed,\r\nImperial troops have driven the\r\nRebel forces from
86+
their hidden\r\nbase and pursued them across\r\nthe galaxy.\r\n\r\nEvading the
87+
dreaded Imperial\r\nStarfleet, a group of freedom\r\nfighters led by Luke Skywalker\r\nhas
88+
established a new secret\r\nbase on the remote ice world\r\nof Hoth.\r\n\r\nThe
89+
evil lord Darth Vader,\r\nobsessed with finding young\r\nSkywalker, has dispatched\r\nthousands
90+
of remote probes into\r\nthe far reaches of space...."
91+
director: Irvin Kershner
92+
producer: Gary Kutz, Rick McCallum
93+
release_date: '1980-05-17'
94+
created_at: '2014-12-12T11:26:24.656000Z'
95+
updated_at: '2015-04-11T09:46:31.433607Z'
96+
97+
the-force-awakens:
98+
title: The Force Awakens
99+
episode_id: 7
100+
opening_crawl: "Luke Skywalker has vanished.\r\nIn his absence, the sinister\r\nFIRST
101+
ORDER has risen from\r\nthe ashes of the Empire\r\nand will not rest until\r\nSkywalker,
102+
the last Jedi,\r\nhas been destroyed.\r\n \r\nWith the support of the\r\nREPUBLIC,
103+
General Leia Organa\r\nleads a brave RESISTANCE.\r\nShe is desperate to find
104+
her\r\nbrother Luke and gain his\r\nhelp in restoring peace and\r\njustice to
105+
the galaxy.\r\n \r\nLeia has sent her most daring\r\npilot on a secret mission\r\nto
106+
Jakku, where an old ally\r\nhas discovered a clue to\r\nLuke's whereabouts...."
107+
director: J. J. Abrams
108+
producer: Kathleen Kennedy, J. J. Abrams, Bryan Burk
109+
release_date: '2015-12-11'
110+
created_at: '2015-04-17T06:51:30.504780Z'
111+
updated_at: '2015-12-17T14:31:47.617768Z'

test/models/film_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'test_helper'
2+
3+
class FilmTest < ActiveSupport::TestCase
4+
# test "the truth" do
5+
# assert true
6+
# end
7+
end

0 commit comments

Comments
 (0)