worth_watching 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +2 -1
- data/README.md +2 -2
- data/lib/worth_watching/aggregator.rb +36 -28
- data/lib/worth_watching/movie.rb +11 -11
- data/lib/worth_watching/version.rb +1 -1
- data/spec/support/html_responses/toy_story_mc.html +1276 -0
- data/spec/support/json_responses/rt_top_16_dvd_rentals.json +35 -0
- data/spec/support/json_responses/rt_top_16_in_cinemas.json +37 -0
- data/spec/support/json_responses/toy_story_omdb.json +1 -0
- data/spec/support/json_responses/toy_story_reviews_rt.json +36 -0
- data/spec/support/json_responses/toy_story_rt.json +1 -0
- data/spec/support/json_responses/toy_story_tmdb.json +1 -0
- data/spec/support/xml_responses/toy_story_omdb.xml +1 -0
- data/spec/test_helper.rb +4 -0
- data/spec/unit/aggregator_spec.rb +83 -0
- data/spec/unit/movie_spec.rb +45 -0
- data/worth_watching.gemspec +1 -4
- metadata +50 -85
- data/spec/vcr_setup.rb +0 -7
- data/spec/worth_watching_spec.rb +0 -139
data/spec/vcr_setup.rb
DELETED
data/spec/worth_watching_spec.rb
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
#worth_watching_spec.rb
|
2
|
-
require 'vcr_setup'
|
3
|
-
require 'worth_watching'
|
4
|
-
|
5
|
-
describe 'WorthWatching' do
|
6
|
-
|
7
|
-
let(:aggregator) {WorthWatching::Aggregator.new}
|
8
|
-
|
9
|
-
describe 'get individual movie info' do
|
10
|
-
|
11
|
-
let(:movie) do
|
12
|
-
VCR.use_cassette('toy story 3') do
|
13
|
-
aggregator.movie_info("770672122")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
let(:release_date) { Date.new(2010, 06, 18) }
|
18
|
-
|
19
|
-
it "should have the title 'Toy Story 3" do
|
20
|
-
movie.title.should == "Toy Story 3"
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should have correct plot'" do
|
24
|
-
movie.plot.should == "Pixar returns to their first success with Toy Story 3. The movie begins with Andy leaving for college and donating his beloved toys -- including Woody (Tom Hanks) and Buzz (Tim Allen) -- to a daycare. While the crew meets new friends, including Ken (Michael Keaton), they soon grow to hate their new surroundings and plan an escape. The film was directed by Lee Unkrich from a script co-authored by Little Miss Sunshine scribe Michael Arndt. ~ Perry Seibert, Rovi"
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should have rotten tomatoes rating 99'" do
|
28
|
-
movie.rt_rating.should == 99
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should have a link to RT page 'http://www.rottentomatoes.com/m/toy_story_3/'" do
|
32
|
-
movie.rt_url.should == "http://www.rottentomatoes.com/m/toy_story_3/"
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should have imdb rating of 8.5" do
|
36
|
-
movie.imdb_rating.should == "8.5"
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should have imdb url 'http://www.imdb.com/title/tt0435761/" do
|
40
|
-
movie.imdb_url.should == "http://www.imdb.com/title/tt0435761/"
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should have metacritic rating of 92" do
|
44
|
-
movie.metacritic_rating.should == "92"
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should have metacritic url 'http://www.metacritic.com/movie/toy-story-3'" do
|
48
|
-
movie.metacritic_url.should == "http://www.metacritic.com/movie/toy-story-3"
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should have cast 'Tom Hanks, Tim Allen, Joan Cusack, Ned Beatty'" do
|
52
|
-
movie.cast.should == "Tom Hanks, Tim Allen, Joan Cusack, Ned Beatty"
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should have release date '2010-06-18'" do
|
56
|
-
movie.release_date.should == release_date
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should have director 'Lee Unkrich'" do
|
60
|
-
movie.director.should == "Lee Unkrich"
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should have genre 'Animation'" do
|
64
|
-
movie.genre.should == "Animation"
|
65
|
-
end
|
66
|
-
|
67
|
-
it "should have the correct poster url" do
|
68
|
-
movie.poster.should == "http://cf2.imgobject.com/t/p/original/tOwAAVeL1p3ls9dhOBo45ElodU3.jpg"
|
69
|
-
end
|
70
|
-
|
71
|
-
describe "movie reviews" do
|
72
|
-
it "should have an author" do
|
73
|
-
#puts movie.reviews.first.to_hash
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should have a date" do
|
77
|
-
|
78
|
-
end
|
79
|
-
|
80
|
-
it "should have rating" do
|
81
|
-
|
82
|
-
end
|
83
|
-
|
84
|
-
it "should have a source" do
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
it "should have a review quote" do
|
89
|
-
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should have a link to the review" do
|
93
|
-
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe "Retrieve movies currently in cinemas" do
|
99
|
-
|
100
|
-
let(:movies) do
|
101
|
-
VCR.use_cassette('in cinemas') do
|
102
|
-
aggregator.in_cinemas(16, :cinema)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
it "should return a non-empty array of movies" do
|
107
|
-
movies.size.should_not == 0
|
108
|
-
end
|
109
|
-
|
110
|
-
it "all movies should have a release date" do
|
111
|
-
movies.each {|movie| movie.release_date.should_not == nil}
|
112
|
-
end
|
113
|
-
|
114
|
-
it "all movies should have a poster url" do
|
115
|
-
movies.each {|movie| puts "#{movie.title} #{movie.rt_rating} | #{movie.imdb_rating} | #{movie.metacritic_rating}"; movie.poster.should_not == nil}
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
describe "Retrieve movies released on DVD" do
|
120
|
-
|
121
|
-
let(:movies) do
|
122
|
-
VCR.use_cassette('in cinemas') do
|
123
|
-
aggregator.in_cinemas(16, :dvd)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
it "should return a non-empty array of movies" do
|
128
|
-
movies.size.should_not == 0
|
129
|
-
end
|
130
|
-
|
131
|
-
it "all movies should have a release date" do
|
132
|
-
movies.each {|movie| movie.release_date.should_not == nil}
|
133
|
-
end
|
134
|
-
|
135
|
-
it "all movies should have a poster url" do
|
136
|
-
movies.each {|movie| puts "#{movie.title} #{movie.rt_rating} | #{movie.imdb_rating} | #{movie.metacritic_rating}"; movie.poster.should_not == nil}
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|