movies 0.1.4 → 0.1.5
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.
- data/lib/movies.rb +1 -1
- data/lib/movies/exclude.yml +2 -1
- data/movies.gemspec +1 -1
- data/spec/exclude_spec.rb +8 -0
- data/spec/fixtures/vcr_cassettes/bug1.yml +1 -1
- data/spec/fixtures/vcr_cassettes/bug2.yml +51 -0
- data/spec/fixtures/vcr_cassettes/n-a-tt1570337.yml +1 -1
- data/spec/fixtures/vcr_cassettes/not_found.yml +1 -1
- data/spec/fixtures/vcr_cassettes/true-grit-1969.yml +1 -1
- data/spec/fixtures/vcr_cassettes/true-grit-2010.yml +1 -1
- data/spec/fixtures/vcr_cassettes/tt0066026.yml +1 -1
- data/spec/fixtures/vcr_cassettes/tt0337978.yml +2 -2
- data/spec/fixtures/vcr_cassettes/tt1285016.yml +1 -1
- data/spec/movies_spec.rb +12 -2
- metadata +3 -1
data/lib/movies.rb
CHANGED
|
@@ -48,7 +48,7 @@ class Movies
|
|
|
48
48
|
return self unless found?
|
|
49
49
|
|
|
50
50
|
content.keys.each do |name|
|
|
51
|
-
instance_variable_set "@" + name.to_s.downcase, (content[name] == "N/A" ?
|
|
51
|
+
instance_variable_set "@" + name.to_s.downcase, (content[name] == "N/A" ? "" : content[name])
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
@year = @year.to_i
|
data/lib/movies/exclude.yml
CHANGED
data/movies.gemspec
CHANGED
data/spec/exclude_spec.rb
CHANGED
|
@@ -140,4 +140,12 @@ describe "exclude.yaml" do
|
|
|
140
140
|
it "should remove TV related data" do
|
|
141
141
|
Movies.cleaner("Bones S06E19 HDTV XviD-LOL").should_not match(/s06e19/i)
|
|
142
142
|
end
|
|
143
|
+
|
|
144
|
+
it "should not contain 'R5'" do
|
|
145
|
+
Movies.cleaner("Just Go With It R5 LiNE XviD-Rx").should_not match(/r5/i)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
it "should not contain 'R6'" do
|
|
149
|
+
Movies.cleaner("Just Go With It R6 LiNE XviD-Rx").should_not match(/r6/i)
|
|
150
|
+
end
|
|
143
151
|
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
|
3
|
+
request: !ruby/struct:VCR::Request
|
|
4
|
+
method: :get
|
|
5
|
+
uri: http://www.imdbapi.com:80/?i=tt0988120
|
|
6
|
+
body:
|
|
7
|
+
headers:
|
|
8
|
+
accept:
|
|
9
|
+
- "*/*; q=0.5, application/xml"
|
|
10
|
+
accept-encoding:
|
|
11
|
+
- gzip, deflate
|
|
12
|
+
timeout:
|
|
13
|
+
- "3"
|
|
14
|
+
response: !ruby/struct:VCR::Response
|
|
15
|
+
status: !ruby/struct:VCR::ResponseStatus
|
|
16
|
+
code: 200
|
|
17
|
+
message: OK
|
|
18
|
+
headers:
|
|
19
|
+
cache-control:
|
|
20
|
+
- no-cache
|
|
21
|
+
pragma:
|
|
22
|
+
- no-cache
|
|
23
|
+
content-type:
|
|
24
|
+
- text/html; charset=utf-8
|
|
25
|
+
content-encoding:
|
|
26
|
+
- gzip
|
|
27
|
+
expires:
|
|
28
|
+
- "-1"
|
|
29
|
+
vary:
|
|
30
|
+
- Accept-Encoding
|
|
31
|
+
server:
|
|
32
|
+
- Microsoft-IIS/7.0
|
|
33
|
+
x-aspnet-version:
|
|
34
|
+
- 4.0.30319
|
|
35
|
+
x-powered-by:
|
|
36
|
+
- ASP.NET
|
|
37
|
+
date:
|
|
38
|
+
- Sat, 30 Apr 2011 18:06:52 GMT
|
|
39
|
+
content-length:
|
|
40
|
+
- "332"
|
|
41
|
+
body: !binary |
|
|
42
|
+
H4sIAAAAAAAEAO29B2AcSZYlJi9tynt/SvVK1+B0oQiAYBMk2JBAEOzBiM3m
|
|
43
|
+
kuwdaUcjKasqgcplVmVdZhZAzO2dvPfee++999577733ujudTif33/8/XGZk
|
|
44
|
+
AWz2zkrayZ4hgKrIHz9+fB8/In7xR2+Ktsw/evTRF9fps7rIl7OPm/TbVZt+
|
|
45
|
+
US3Sg49GH/0+eVbT13s7Ow/or1dZm8/ozxd3j/FXXuZZwx/o95/nyxrQjmfr
|
|
46
|
+
sqW/nxZ1Pm0rQHhS522bPqmz5ayib75bF22OzwXUMVo19OfxZZY+zS+LZT5K
|
|
47
|
+
XxTLLP12VhOG16P0i2I5u06/yIrlKP0c37yqZnVxsc5/QO+/LKuW3hZgL6vG
|
|
48
|
+
h/1qvWyLBdDSv7O2WF7YP3+yanP0LH+dPaVf23bn4cHB7t4OffAqb1bVssHr
|
|
49
|
+
b+p1/tEv+X8AlsnB2DQBAAA=
|
|
50
|
+
|
|
51
|
+
http_version: "1.1"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
x-powered-by:
|
|
36
36
|
- ASP.NET
|
|
37
37
|
date:
|
|
38
|
-
- Sat, 30 Apr 2011
|
|
38
|
+
- Sat, 30 Apr 2011 18:07:02 GMT
|
|
39
39
|
content-length:
|
|
40
40
|
- "643"
|
|
41
41
|
body: !binary |
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
x-powered-by:
|
|
93
93
|
- ASP.NET
|
|
94
94
|
date:
|
|
95
|
-
- Sat, 30 Apr 2011
|
|
95
|
+
- Sat, 30 Apr 2011 18:07:04 GMT
|
|
96
96
|
content-length:
|
|
97
97
|
- "583"
|
|
98
98
|
body: !binary |
|
data/spec/movies_spec.rb
CHANGED
|
@@ -120,14 +120,24 @@ describe Movies do
|
|
|
120
120
|
end
|
|
121
121
|
end
|
|
122
122
|
|
|
123
|
+
context "bug2" do
|
|
124
|
+
use_vcr_cassette "bug2"
|
|
125
|
+
it "should not raise an error when date is invalid" do
|
|
126
|
+
lambda {
|
|
127
|
+
Movies.new("http://www.imdbapi.com/?i=tt0988120").prepare.released.should be_nil
|
|
128
|
+
}.should_not raise_error
|
|
129
|
+
a_request(:get, "http://www.imdbapi.com/?i=tt0988120").should have_been_made.once
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
123
133
|
context "N/A" do
|
|
124
134
|
use_vcr_cassette "n-a-tt1570337"
|
|
125
135
|
it "Fields that contains N/A should be nil or zero" do
|
|
126
136
|
movie = Movies.new("http://www.imdbapi.com/?i=tt1570337").prepare
|
|
127
137
|
|
|
128
138
|
movie.runtime.should eq(0)
|
|
129
|
-
movie.plot.should
|
|
130
|
-
movie.rated.should
|
|
139
|
+
movie.plot.should be_empty
|
|
140
|
+
movie.rated.should be_empty
|
|
131
141
|
|
|
132
142
|
a_request(:get, "http://www.imdbapi.com/?i=tt1570337").should have_been_made.once
|
|
133
143
|
end
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: movies
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.1.
|
|
5
|
+
version: 0.1.5
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Linus Oleander
|
|
@@ -88,6 +88,7 @@ files:
|
|
|
88
88
|
- movies.gemspec
|
|
89
89
|
- spec/exclude_spec.rb
|
|
90
90
|
- spec/fixtures/vcr_cassettes/bug1.yml
|
|
91
|
+
- spec/fixtures/vcr_cassettes/bug2.yml
|
|
91
92
|
- spec/fixtures/vcr_cassettes/n-a-tt1570337.yml
|
|
92
93
|
- spec/fixtures/vcr_cassettes/not_found.yml
|
|
93
94
|
- spec/fixtures/vcr_cassettes/true-grit-1969.yml
|
|
@@ -128,6 +129,7 @@ summary: Movies is the bridge between IMDb's unofficial API; imdbapi.com and Rub
|
|
|
128
129
|
test_files:
|
|
129
130
|
- spec/exclude_spec.rb
|
|
130
131
|
- spec/fixtures/vcr_cassettes/bug1.yml
|
|
132
|
+
- spec/fixtures/vcr_cassettes/bug2.yml
|
|
131
133
|
- spec/fixtures/vcr_cassettes/n-a-tt1570337.yml
|
|
132
134
|
- spec/fixtures/vcr_cassettes/not_found.yml
|
|
133
135
|
- spec/fixtures/vcr_cassettes/true-grit-1969.yml
|