movies 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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" ? nil : content[name])
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
@@ -23,4 +23,5 @@ excluded:
23
23
  - (.+)?SUB
24
24
  - NTSC
25
25
  - PAL
26
- - "S\d{1,2}E\d{1,2}"
26
+ - "S\d{1,2}E\d{1,2}"
27
+ - "R[4|5|6]"
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "movies"
6
- s.version = "0.1.4"
6
+ s.version = "0.1.5"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Linus Oleander"]
9
9
  s.email = ["linus@oleander.nu"]
@@ -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
@@ -35,7 +35,7 @@
35
35
  x-powered-by:
36
36
  - ASP.NET
37
37
  date:
38
- - Sat, 30 Apr 2011 15:55:20 GMT
38
+ - Sat, 30 Apr 2011 18:06:51 GMT
39
39
  content-length:
40
40
  - "469"
41
41
  body: !binary |
@@ -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 15:55:20 GMT
38
+ - Sat, 30 Apr 2011 18:06:53 GMT
39
39
  content-length:
40
40
  - "462"
41
41
  body: !binary |
@@ -81,7 +81,7 @@
81
81
  x-powered-by:
82
82
  - ASP.NET
83
83
  date:
84
- - Sat, 30 Apr 2011 15:55:19 GMT
84
+ - Sat, 30 Apr 2011 18:06:48 GMT
85
85
  content-length:
86
86
  - "144"
87
87
  body: !binary |
@@ -193,7 +193,7 @@
193
193
  x-powered-by:
194
194
  - ASP.NET
195
195
  date:
196
- - Sat, 30 Apr 2011 15:55:14 GMT
196
+ - Sat, 30 Apr 2011 18:06:45 GMT
197
197
  content-length:
198
198
  - "593"
199
199
  body: !binary |
@@ -89,7 +89,7 @@
89
89
  x-powered-by:
90
90
  - ASP.NET
91
91
  date:
92
- - Sat, 30 Apr 2011 15:55:15 GMT
92
+ - Sat, 30 Apr 2011 18:06:46 GMT
93
93
  content-length:
94
94
  - "540"
95
95
  body: !binary |
@@ -136,7 +136,7 @@
136
136
  x-powered-by:
137
137
  - ASP.NET
138
138
  date:
139
- - Sat, 30 Apr 2011 15:55:17 GMT
139
+ - Sat, 30 Apr 2011 18:06:47 GMT
140
140
  content-length:
141
141
  - "571"
142
142
  body: !binary |
@@ -35,7 +35,7 @@
35
35
  x-powered-by:
36
36
  - ASP.NET
37
37
  date:
38
- - Sat, 30 Apr 2011 15:55:22 GMT
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 15:55:23 GMT
95
+ - Sat, 30 Apr 2011 18:07:04 GMT
96
96
  content-length:
97
97
  - "583"
98
98
  body: !binary |
@@ -182,7 +182,7 @@
182
182
  x-powered-by:
183
183
  - ASP.NET
184
184
  date:
185
- - Sat, 30 Apr 2011 15:55:16 GMT
185
+ - Sat, 30 Apr 2011 18:06:46 GMT
186
186
  content-length:
187
187
  - "550"
188
188
  body: !binary |
@@ -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 be_nil
130
- movie.rated.should be_nil
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.4
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