spotlite 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,7 +19,8 @@ IMDB_SAMPLES = {
19
19
  "http://www.imdb.com/title/tt0317248/" => "tt0317248/index",
20
20
  "http://www.imdb.com/title/tt0169547/" => "tt0169547/index",
21
21
  "http://www.imdb.com/title/tt0047396/releaseinfo" => "tt0047396/releaseinfo",
22
- "http://www.imdb.com/title/tt0002186/" => "tt0002186/index"
22
+ "http://www.imdb.com/title/tt0002186/" => "tt0002186/index",
23
+ "http://www.imdb.com/find?q=the+core&s=all" => "search_the_core"
23
24
  }
24
25
 
25
26
  unless ENV['LIVE_TEST']
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Spotlite::Search" do
4
+ before(:each) do
5
+ @search = Spotlite::Search.new("the core")
6
+ end
7
+
8
+ it "should return 7 results" do
9
+ @search.movies.size.should eql(7)
10
+ end
11
+
12
+ it "should return Spotlite::Movie objects" do
13
+ @search.movies.each { |movie| movie.should be_a(Spotlite::Movie) }
14
+ end
15
+
16
+ it "should return IMDb ID, title, and year" do
17
+ @search.movies.first.imdb_id.should eql("0298814")
18
+ @search.movies.first.title.should eql("The Core")
19
+ @search.movies.first.year.should eql(2003)
20
+ end
21
+
22
+ it "should not contain video games" do
23
+ @search.movies.each { |movie| movie.imdb_id.should_not eql("0483593") }
24
+ end
25
+
26
+ it "should not contain TV series/episodes" do
27
+ @search.movies.each { |movie| movie.imdb_id.should_not eql("1979599") }
28
+ end
29
+ end
@@ -4,7 +4,7 @@ namespace :fixtures do
4
4
  require File.expand_path(File.dirname(__FILE__) + "/../spec/spec_helper")
5
5
 
6
6
  IMDB_SAMPLES.each_pair do |url, fixture|
7
- page = `curl -is #{url} --header "Accept-Language: en-us"`
7
+ page = `curl -isH "Accept-Language: en-us" #{url}`
8
8
 
9
9
  File.open(File.expand_path(File.dirname(__FILE__) + "/../spec/fixtures/#{fixture}"), 'w') do |f|
10
10
  f.write(page)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spotlite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-12 00:00:00.000000000 Z
12
+ date: 2013-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -75,8 +75,12 @@ files:
75
75
  - README.md
76
76
  - Rakefile
77
77
  - lib/spotlite.rb
78
+ - lib/spotlite/list.rb
78
79
  - lib/spotlite/movie.rb
80
+ - lib/spotlite/search.rb
81
+ - lib/spotlite/string_extensions.rb
79
82
  - lib/spotlite/version.rb
83
+ - spec/fixtures/search_the_core
80
84
  - spec/fixtures/tt0002186/index
81
85
  - spec/fixtures/tt0047396/releaseinfo
82
86
  - spec/fixtures/tt0133093/fullcredits
@@ -88,6 +92,7 @@ files:
88
92
  - spec/fixtures/tt0317248/index
89
93
  - spec/spec_helper.rb
90
94
  - spec/spotlite/movie_spec.rb
95
+ - spec/spotlite/search_spec.rb
91
96
  - spotlite.gemspec
92
97
  - tasks/fixtures.rake
93
98
  homepage: http://github.com/defeed/spotlite
@@ -115,6 +120,7 @@ signing_key:
115
120
  specification_version: 3
116
121
  summary: Ruby gem to fetch publicly available information about movies from IMDb
117
122
  test_files:
123
+ - spec/fixtures/search_the_core
118
124
  - spec/fixtures/tt0002186/index
119
125
  - spec/fixtures/tt0047396/releaseinfo
120
126
  - spec/fixtures/tt0133093/fullcredits
@@ -126,3 +132,4 @@ test_files:
126
132
  - spec/fixtures/tt0317248/index
127
133
  - spec/spec_helper.rb
128
134
  - spec/spotlite/movie_spec.rb
135
+ - spec/spotlite/search_spec.rb