icheckmovies 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +5 -0
- data/Gemfile +4 -0
- data/README.md +45 -0
- data/Rakefile +2 -0
- data/icheckmovies.gemspec +27 -0
- data/lib/icheckmovies.rb +40 -0
- data/spec/fixtures/vcr_cassettes/the_best_1000_movies_ever_made.yml +2581 -0
- data/spec/icheckmovies_spec.rb +33 -0
- data/spec/spec_helper.rb +18 -0
- metadata +120 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe ICheckMovies do
|
4
|
+
use_vcr_cassette "the+best+1000+movies+ever+made"
|
5
|
+
let(:href_matcher) { %r{^((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$} }
|
6
|
+
let(:url) { "http://www.icheckmovies.com/list/the+best+1000+movies+ever+made/" }
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@check = ICheckMovies.fetch(url)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have 1002 movies" do
|
13
|
+
@check.should have(1002).movies
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have some accessors" do
|
17
|
+
@check.movies.each do |movie|
|
18
|
+
movie.imdb_link.should match(%r{http://www.imdb.com/title/tt\d{7}/})
|
19
|
+
movie.title.should_not be_empty
|
20
|
+
movie.year.should > 1800
|
21
|
+
movie.details.should match(href_matcher)
|
22
|
+
movie.id.should match(/^tt\d{7}$/)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should be able to return the given url" do
|
27
|
+
@check.url.should eq(url)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have a name" do
|
31
|
+
@check.name.should eq("The Best 1,000 Movies Ever Made top movies")
|
32
|
+
end
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "rspec"
|
2
|
+
require "webmock/rspec"
|
3
|
+
require "vcr"
|
4
|
+
require "icheckmovies"
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.mock_with :rspec
|
8
|
+
config.extend VCR::RSpec::Macros
|
9
|
+
end
|
10
|
+
|
11
|
+
VCR.config do |c|
|
12
|
+
c.cassette_library_dir = "spec/fixtures/vcr_cassettes"
|
13
|
+
c.stub_with :webmock
|
14
|
+
c.default_cassette_options = {
|
15
|
+
record: :new_episodes
|
16
|
+
}
|
17
|
+
c.allow_http_connections_when_no_cassette = false
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: icheckmovies
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.5.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Linus Oleander
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-09-21 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rest-client
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: nokogiri
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: vcr
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id003
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rspec
|
50
|
+
prerelease: false
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
type: :development
|
58
|
+
version_requirements: *id004
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: webmock
|
61
|
+
prerelease: false
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
type: :development
|
69
|
+
version_requirements: *id005
|
70
|
+
description: Unofficial API for iCheckMovies.com
|
71
|
+
email:
|
72
|
+
- linus@oleander.nu
|
73
|
+
executables: []
|
74
|
+
|
75
|
+
extensions: []
|
76
|
+
|
77
|
+
extra_rdoc_files: []
|
78
|
+
|
79
|
+
files:
|
80
|
+
- .gitignore
|
81
|
+
- .rspec
|
82
|
+
- Gemfile
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- icheckmovies.gemspec
|
86
|
+
- lib/icheckmovies.rb
|
87
|
+
- spec/fixtures/vcr_cassettes/the_best_1000_movies_ever_made.yml
|
88
|
+
- spec/icheckmovies_spec.rb
|
89
|
+
- spec/spec_helper.rb
|
90
|
+
homepage: https://github.com/oleander/icheckmovies
|
91
|
+
licenses: []
|
92
|
+
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: "0"
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: "0"
|
110
|
+
requirements: []
|
111
|
+
|
112
|
+
rubyforge_project: icheckmovies
|
113
|
+
rubygems_version: 1.8.8
|
114
|
+
signing_key:
|
115
|
+
specification_version: 3
|
116
|
+
summary: Unofficial API for iCheckMovies
|
117
|
+
test_files:
|
118
|
+
- spec/fixtures/vcr_cassettes/the_best_1000_movies_ever_made.yml
|
119
|
+
- spec/icheckmovies_spec.rb
|
120
|
+
- spec/spec_helper.rb
|