bootleg 0.0.3 → 0.0.4
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.
- data/Gemfile +1 -0
- data/lib/bootleg/version.rb +1 -1
- data/lib/finder.rb +1 -1
- data/lib/modules/theater.rb +5 -4
- data/spec/.rspec +2 -0
- data/spec/extractor_spec.rb +59 -0
- data/spec/finder_spec.rb +26 -0
- data/spec/presenter_spec.rb +7 -0
- data/spec/spec_helper.rb +8 -0
- metadata +13 -3
data/Gemfile
CHANGED
data/lib/bootleg/version.rb
CHANGED
data/lib/finder.rb
CHANGED
data/lib/modules/theater.rb
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
require_relative 'movie'
|
|
2
2
|
|
|
3
3
|
module Theater
|
|
4
|
-
def details
|
|
5
|
-
self.css('h3.title').css('a')
|
|
6
|
-
end
|
|
7
|
-
|
|
8
4
|
def name
|
|
9
5
|
details.text.strip
|
|
10
6
|
end
|
|
@@ -23,4 +19,9 @@ module Theater
|
|
|
23
19
|
end
|
|
24
20
|
values
|
|
25
21
|
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
def details
|
|
25
|
+
self.css('h3.title').css('a')
|
|
26
|
+
end
|
|
26
27
|
end
|
data/spec/.rspec
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Extractor do
|
|
4
|
+
it "should raise an error withouth arguments" do
|
|
5
|
+
expect{ Extractor.new }.to raise_error(ArgumentError)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "should not raise error with one argument" do
|
|
9
|
+
expect { Extractor.new("http://www.moviefone.com")}.to_not raise_error(ArgumentError)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "should raise an error with more then one argument" do
|
|
13
|
+
expect { Extractor.new("arg1", "arg2") }.to raise_error(ArgumentError)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
before :all do
|
|
17
|
+
@theaters = Extractor.new("http://www.moviefone.com/showtimes/manchester-md/21102/theaters").page_theaters
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "should pull out no more then 5 theaters" do
|
|
21
|
+
@theaters.size.should eq(5)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe Theater do
|
|
25
|
+
before :all do
|
|
26
|
+
@theater = @theaters[1]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "name should match expression" do
|
|
30
|
+
expect(@theater[:name]).to match(/(\w|\s)/)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "href should be a link" do
|
|
34
|
+
expect(@theater[:href]).to match(/http:\/\/www\.moviefone\.com/)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe Movie do
|
|
38
|
+
|
|
39
|
+
before :all do
|
|
40
|
+
@movie = @theater[:movies].first
|
|
41
|
+
end
|
|
42
|
+
it "should have a name, href and showtimes" do
|
|
43
|
+
expect(@movie.size).to eq(3)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "name should match expression" do
|
|
47
|
+
expect(@movie[:name]).to match(/(\w|\s)/)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "href shoud mathc expression" do
|
|
51
|
+
expect(@movie[:href]).to match(/http:\/\/www\.moviefone\.com/)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "shotimes returns an array" do
|
|
55
|
+
expect(@movie[:showtimes].class).to be(Array)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
data/spec/finder_spec.rb
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Finder do
|
|
4
|
+
it "should raise an error with no arguments" do
|
|
5
|
+
expect { Finder.new }.to raise_error(ArgumentError)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it "should not raise error with one argument" do
|
|
9
|
+
expect { Finder.new("smth") }.to_not raise_error(ArgumentError)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "should raise an error with more then one arguments" do
|
|
13
|
+
expect { Finder.new("smth", "smthelse") }.to raise_error(ArgumentError)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
describe Href do
|
|
18
|
+
before :all do
|
|
19
|
+
@hrefs = Finder.new('21102').hrefs
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should have a size of 3" do
|
|
23
|
+
expect(@hrefs.size).to eq(3)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bootleg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
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: 2012-11-
|
|
12
|
+
date: 2012-11-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: nokogiri
|
|
@@ -84,6 +84,11 @@ files:
|
|
|
84
84
|
- lib/modules/theater.rb
|
|
85
85
|
- lib/modules/zipcode.rb
|
|
86
86
|
- lib/presenter.rb
|
|
87
|
+
- spec/.rspec
|
|
88
|
+
- spec/extractor_spec.rb
|
|
89
|
+
- spec/finder_spec.rb
|
|
90
|
+
- spec/presenter_spec.rb
|
|
91
|
+
- spec/spec_helper.rb
|
|
87
92
|
homepage: ''
|
|
88
93
|
licenses: []
|
|
89
94
|
post_install_message:
|
|
@@ -108,4 +113,9 @@ rubygems_version: 1.8.24
|
|
|
108
113
|
signing_key:
|
|
109
114
|
specification_version: 3
|
|
110
115
|
summary: ! '...comming soon...'
|
|
111
|
-
test_files:
|
|
116
|
+
test_files:
|
|
117
|
+
- spec/.rspec
|
|
118
|
+
- spec/extractor_spec.rb
|
|
119
|
+
- spec/finder_spec.rb
|
|
120
|
+
- spec/presenter_spec.rb
|
|
121
|
+
- spec/spec_helper.rb
|