movies 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -52,14 +52,14 @@ class Movies
52
52
  end
53
53
 
54
54
  @year = @year.to_i
55
- @genres = @genre.split(",")
56
- @writers = @writer.split(",")
55
+ @genres = @genre.split(", ")
56
+ @writers = @writer.split(", ")
57
57
  @actors = @actors.split(", ")
58
58
  @rating = @rating.to_f
59
59
  @votes = @votes.to_i
60
60
 
61
61
  if @runtime =~ /(\d+).+?(\d+)/
62
- @runtime = $1.to_i * 60 + $1.to_i
62
+ @runtime = $1.to_i * 60 + $2.to_i
63
63
  elsif @runtime =~ /(\d+) hrs/
64
64
  @runtime = $1.to_i * 60
65
65
  else
@@ -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.5"
6
+ s.version = "0.1.6"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Linus Oleander"]
9
9
  s.email = ["linus@oleander.nu"]
@@ -35,7 +35,7 @@
35
35
  x-powered-by:
36
36
  - ASP.NET
37
37
  date:
38
- - Sat, 30 Apr 2011 18:06:51 GMT
38
+ - Sat, 30 Apr 2011 23:20:15 GMT
39
39
  content-length:
40
40
  - "469"
41
41
  body: !binary |
@@ -35,7 +35,7 @@
35
35
  x-powered-by:
36
36
  - ASP.NET
37
37
  date:
38
- - Sat, 30 Apr 2011 18:06:52 GMT
38
+ - Sat, 30 Apr 2011 23:20:16 GMT
39
39
  content-length:
40
40
  - "332"
41
41
  body: !binary |
@@ -0,0 +1,56 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://www.imdbapi.com:80/?i=tt0058371
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 23:20:16 GMT
39
+ content-length:
40
+ - "573"
41
+ body: !binary |
42
+ H4sIAAAAAAAEAO29B2AcSZYlJi9tynt/SvVK1+B0oQiAYBMk2JBAEOzBiM3m
43
+ kuwdaUcjKasqgcplVmVdZhZAzO2dvPfee++999577733ujudTif33/8/XGZk
44
+ AWz2zkrayZ4hgKrIHz9+fB8/In7xR2+Ktsw/evTRm3meflFVy+3Xq2K5zOvm
45
+ o9FHv0+e1fTV7sNP9+mvV1mbz+jPz/F7XuZZw38epN9Zl6m2+Txf1oD2LFsU
46
+ 5fUo/eK6afOafnlVLbLlNKcmT4s6n7YVAH8nW+RN+iIvyqZa0lffrQtqTV98
47
+ UUznWV6mT6+XOQHJ6uv0dZtfZXVLrY7xdkOtvp1dl/l1+kVRls0oPS2L9LtZ
48
+ WWbT+Sh9WZUZAb6oC/o9J6DpF9NTGtU1vf+yrFp6+/ep1suL9HR5URbNPL0o
49
+ 6jJ9Ubx9e51my1k6pzey9bJNs7ouLvM0a9O2S6BRmqXzqiU0q2V6UlMvo7St
50
+ 6MMybxpqni3TfNnO102RNW0xTa/yclot8vF4DCQqEIbQmLft6tHdu0U2XuSz
51
+ ItsuFrPJmNrdLRbZRd7c/eLuFz95/8kXby72v/jpsx/Q//dePKO/y/tPsuWT
52
+ 5e/99ln7U2+mV18+ne5/+ebi3Rc/8Xv+nuPf/yd3x7//69/73t7O+KdXF9TZ
53
+ KxpJscC87KbzOr1/kC6KJSaYprRYXtDnn44f0J8/SaMBYQ8e3KO/zp7Sr227
54
+ s3P/4N6DXfrgVd6sqmUDOG/qdf7RL/l/ALTFvcI+AgAA
55
+
56
+ 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 18:06:53 GMT
38
+ - Sat, 30 Apr 2011 23:20:17 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 18:06:48 GMT
84
+ - Sat, 30 Apr 2011 23:20:15 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 18:06:45 GMT
196
+ - Sat, 30 Apr 2011 23:20:13 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 18:06:46 GMT
92
+ - Sat, 30 Apr 2011 23:20:13 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 18:06:47 GMT
139
+ - Sat, 30 Apr 2011 23:20:14 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 18:07:02 GMT
38
+ - Sat, 30 Apr 2011 23:20:17 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 18:07:04 GMT
95
+ - Sat, 30 Apr 2011 23:20:18 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 18:06:46 GMT
185
+ - Sat, 30 Apr 2011 23:20:14 GMT
186
186
  content-length:
187
187
  - "550"
188
188
  body: !binary |
@@ -87,25 +87,41 @@ describe Movies do
87
87
  movie.id.should eq("tt1285016")
88
88
  movie.director.should eq("David Fincher")
89
89
  movie.href.should eq("http://www.imdb.com/title/tt1285016/")
90
+
91
+ movie.genres.each do |genre|
92
+ genre.should eq(genre.strip)
93
+ end
94
+
95
+ movie.actors.each do |actor|
96
+ actor.should eq(actor.strip)
97
+ end
98
+
99
+ movie.writers.each do |writer|
100
+ writer.should eq(writer.strip)
101
+ end
90
102
  end
91
103
  end
92
104
 
93
105
  context "tt0066026" do
94
106
  use_vcr_cassette "tt0066026"
95
- it "should be possible to pass params" do
107
+ it "should be possible to pass params" do
96
108
  Movies.new("http://www.imdbapi.com/?i=tt0066026", {
97
109
  y: "1970"
98
110
  }).prepare
99
-
111
+ end
112
+
113
+ after(:each) do
100
114
  a_request(:get, "http://www.imdbapi.com/?i=tt0066026&y=1970").should have_been_made.once
101
115
  end
102
116
  end
103
117
 
104
118
  context "not_found" do
105
119
  use_vcr_cassette "not_found"
106
- it "should be set to not found" do
120
+ it "should be set to not found" do
107
121
  Movies.new("http://www.imdbapi.com/?i=ttrandom").prepare.should_not be_found
108
-
122
+ end
123
+
124
+ after(:each) do
109
125
  a_request(:get, "http://www.imdbapi.com/?i=ttrandom").should have_been_made.once
110
126
  end
111
127
  end
@@ -116,6 +132,9 @@ describe Movies do
116
132
  lambda {
117
133
  Movies.new("http://www.imdbapi.com/?t=Consinsual&y=2010").prepare.released.should be_nil
118
134
  }.should_not raise_error
135
+ end
136
+
137
+ after(:each) do
119
138
  a_request(:get, "http://www.imdbapi.com/?t=Consinsual&y=2010").should have_been_made.once
120
139
  end
121
140
  end
@@ -126,10 +145,24 @@ describe Movies do
126
145
  lambda {
127
146
  Movies.new("http://www.imdbapi.com/?i=tt0988120").prepare.released.should be_nil
128
147
  }.should_not raise_error
148
+ end
149
+
150
+ after(:each) do
129
151
  a_request(:get, "http://www.imdbapi.com/?i=tt0988120").should have_been_made.once
130
152
  end
131
153
  end
132
154
 
155
+ context "bug3" do
156
+ use_vcr_cassette "bug3"
157
+ it "should contain the correct length" do
158
+ Movies.new("http://www.imdbapi.com/?i=tt0058371").prepare.runtime.should eq(118)
159
+ end
160
+
161
+ after(:each) do
162
+ a_request(:get, "http://www.imdbapi.com/?i=tt0058371").should have_been_made.once
163
+ end
164
+ end
165
+
133
166
  context "N/A" do
134
167
  use_vcr_cassette "n-a-tt1570337"
135
168
  it "Fields that contains N/A should be nil or zero" do
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
5
+ version: 0.1.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Linus Oleander
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-30 00:00:00 +02:00
13
+ date: 2011-05-01 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -89,6 +89,7 @@ files:
89
89
  - spec/exclude_spec.rb
90
90
  - spec/fixtures/vcr_cassettes/bug1.yml
91
91
  - spec/fixtures/vcr_cassettes/bug2.yml
92
+ - spec/fixtures/vcr_cassettes/bug3.yml
92
93
  - spec/fixtures/vcr_cassettes/n-a-tt1570337.yml
93
94
  - spec/fixtures/vcr_cassettes/not_found.yml
94
95
  - spec/fixtures/vcr_cassettes/true-grit-1969.yml
@@ -130,6 +131,7 @@ test_files:
130
131
  - spec/exclude_spec.rb
131
132
  - spec/fixtures/vcr_cassettes/bug1.yml
132
133
  - spec/fixtures/vcr_cassettes/bug2.yml
134
+ - spec/fixtures/vcr_cassettes/bug3.yml
133
135
  - spec/fixtures/vcr_cassettes/n-a-tt1570337.yml
134
136
  - spec/fixtures/vcr_cassettes/not_found.yml
135
137
  - spec/fixtures/vcr_cassettes/true-grit-1969.yml