royw-imdb 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.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 1
3
- :patch: 4
3
+ :patch: 5
4
4
  :major: 0
@@ -161,9 +161,9 @@ class ImdbProfile
161
161
  # 5) released years plus/minus a year
162
162
  # 6) no years
163
163
  def self.lookup(titles, media_years, production_years, released_years)
164
- media_years = media_years.collect{|y| y > 0 ? y : nil}.uniq.compact unless media_years.blank?
165
- production_years = production_years.collect{|y| y > 0 ? y : nil}.uniq.compact unless production_years.blank?
166
- released_years = released_years.collect{|y| y > 0 ? y : nil}.uniq.compact unless released_years.blank?
164
+ media_years = media_years.compact.collect{|y| y.to_i > 0 ? y : nil}.uniq.compact unless media_years.blank?
165
+ production_years = production_years.compact.collect{|y| y.to_i > 0 ? y : nil}.uniq.compact unless production_years.blank?
166
+ released_years = released_years.compact.collect{|y| y.to_i > 0 ? y : nil}.uniq.compact unless released_years.blank?
167
167
  idents = []
168
168
  year_sets = []
169
169
  year_sets << media_years unless media_years.blank?
@@ -173,6 +173,51 @@ describe "ImdbProfile" do
173
173
  profile.should be_nil
174
174
  end
175
175
 
176
+ it "should handle media year == nil" do
177
+ profile = ImdbProfile.first(:titles => ['National Treasure: Book of Secrets'], :media_years => [nil])
178
+ profile.should_not == nil
179
+ end
180
+
181
+ it "should handle media year == 0" do
182
+ profile = ImdbProfile.first(:titles => ['National Treasure: Book of Secrets'], :media_years => [0])
183
+ profile.should_not == nil
184
+ end
185
+
186
+ it "should handle media year == '0'" do
187
+ profile = ImdbProfile.first(:titles => ['National Treasure: Book of Secrets'], :media_years => ['0'])
188
+ profile.should_not == nil
189
+ end
190
+
191
+ it "should handle production year == nil" do
192
+ profile = ImdbProfile.first(:titles => ['National Treasure: Book of Secrets'], :production_years => [nil])
193
+ profile.should_not == nil
194
+ end
195
+
196
+ it "should handle media production == 0" do
197
+ profile = ImdbProfile.first(:titles => ['National Treasure: Book of Secrets'], :production_years => [0])
198
+ profile.should_not == nil
199
+ end
200
+
201
+ it "should handle production year == '0'" do
202
+ profile = ImdbProfile.first(:titles => ['National Treasure: Book of Secrets'], :production_years => ['0'])
203
+ profile.should_not == nil
204
+ end
205
+
206
+ it "should handle released year == nil" do
207
+ profile = ImdbProfile.first(:titles => ['National Treasure: Book of Secrets'], :released_years => [nil])
208
+ profile.should_not == nil
209
+ end
210
+
211
+ it "should handle released year == 0" do
212
+ profile = ImdbProfile.first(:titles => ['National Treasure: Book of Secrets'], :released_years => [0])
213
+ profile.should_not == nil
214
+ end
215
+
216
+ it "should handle released year == '0'" do
217
+ profile = ImdbProfile.first(:titles => ['National Treasure: Book of Secrets'], :released_years => ['0'])
218
+ profile.should_not == nil
219
+ end
220
+
176
221
  def get_temp_filename
177
222
  outfile = Tempfile.new('imdb_profile_spec', TMPDIR)
178
223
  filespec = outfile.path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: royw-imdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roy Wright