cineworld_uk 1.0.0
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.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +59 -0
- data/Rakefile +15 -0
- data/cineworld_uk.gemspec +29 -0
- data/lib/cineworld_uk.rb +15 -0
- data/lib/cineworld_uk/cinema.rb +218 -0
- data/lib/cineworld_uk/film.rb +47 -0
- data/lib/cineworld_uk/internal/film_with_screenings_parser.rb +128 -0
- data/lib/cineworld_uk/screening.rb +33 -0
- data/lib/cineworld_uk/version.rb +6 -0
- data/test/fixtures/cinemas.html +420 -0
- data/test/fixtures/cinemas/brighton.html +8 -0
- data/test/fixtures/cinemas/bristol.html +1206 -0
- data/test/fixtures/cinemas/bury-st-edmunds.html +1211 -0
- data/test/fixtures/cinemas/chelsea.html +1030 -0
- data/test/fixtures/cinemas/the-o2-grenwich.html +1191 -0
- data/test/fixtures/whatson/brighton.html +7906 -0
- data/test/fixtures/whatson/brighton/autism-friendly-cloudy-2.html +79 -0
- data/test/fixtures/whatson/brighton/geethanjali-malayalam.html +71 -0
- data/test/fixtures/whatson/brighton/gravity.html +2129 -0
- data/test/fixtures/whatson/brighton/take-2-thursday-about-time.html +89 -0
- data/test/fixtures/whatson/glasgow-imax-at-gsc-cinema.html +3160 -0
- data/test/fixtures/whatson/glasgow-imax-at-gsc/the-hunger-games-catching-fire.html +498 -0
- data/test/fixtures/whatson/the-o2-greenwich.html +6854 -0
- data/test/fixtures/whatson/the-o2-greenwich/gravity.html +784 -0
- data/test/fixtures/whatson/wandsworth.html +13729 -0
- data/test/fixtures/whatson/wandsworth/arrambam-tamil.html +126 -0
- data/test/fixtures/whatson/wandsworth/bolshoi-ballet-live-lost-illusions.html +80 -0
- data/test/fixtures/whatson/wandsworth/frankenstein-nt-50th.html +82 -0
- data/test/fixtures/whatson/wandsworth/met-opera-falstaff.html +74 -0
- data/test/fixtures/whatson/wandsworth/nt-live-war-horse.html +80 -0
- data/test/fixtures/whatson/wandsworth/royal-ballet-live-the-sleeping-beauty.html +79 -0
- data/test/fixtures/whatson/wandsworth/royal-opera-live-parsifal-weird-date.html +79 -0
- data/test/fixtures/whatson/wandsworth/rsc-live-richard-ii-encore.html +80 -0
- data/test/fixtures/whatson/wandsworth/west-end-theatre-series-private-lives.html +80 -0
- data/test/lib/cineworld_uk/cinema_test.rb +466 -0
- data/test/lib/cineworld_uk/film_test.rb +95 -0
- data/test/lib/cineworld_uk/internal/film_with_screenings_parser_test.rb +200 -0
- data/test/lib/cineworld_uk/screening_test.rb +31 -0
- data/test/lib/cineworld_uk/version_test.rb +9 -0
- data/test/test_helper.rb +6 -0
- metadata +219 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="span2">
|
3
|
+
<div class="poster">
|
4
|
+
<a href="/whatson/6380?cinema=65&date=all">
|
5
|
+
<div class="image">
|
6
|
+
<img src="/cw/assets/images/whatson/film.placeholder.poster.jpg" data-original="/assets/media/films/6380_poster_large.jpg" width="140" alt="Poster for Film Royal Opera Live: Parsifal - Wednesday 18 Dec 2013" />
|
7
|
+
</div>
|
8
|
+
</a>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="span7">
|
13
|
+
<h1>
|
14
|
+
<a href="/whatson/6380?cinema=65&date=all">Royal Opera Live: Parsifal - Wednesday 18 Dec 2013</a>
|
15
|
+
</h1>
|
16
|
+
|
17
|
+
<div class="inline-children">
|
18
|
+
<h3>Release date:</h3>
|
19
|
+
<p>18th December 2013</p>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div class="inline-children">
|
23
|
+
<h3>Running time:</h3>
|
24
|
+
<p>330 mins</p>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<h3>Synopsis:</h3>
|
28
|
+
<p>
|
29
|
+
An exciting new production of Wagner's last great masterpiece from the team behind the acclaimed 'Minotaur'.
|
30
|
+
</p>
|
31
|
+
|
32
|
+
<h3>Available screening types</h3>
|
33
|
+
|
34
|
+
<ul class="unstyled">
|
35
|
+
<li class="icon-service-twod"></li>
|
36
|
+
|
37
|
+
</ul>
|
38
|
+
|
39
|
+
<a class="action primary" title="Find out more about Royal Opera Live: Parsifal - Wednesday 18 Dec 2013" href="/whatson/6380?cinema=65&date=all">Find out more</a>
|
40
|
+
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<br />
|
45
|
+
<p>
|
46
|
+
<strong>
|
47
|
+
Select a showtime and book to save 10% on your tickets with
|
48
|
+
<span class="icon-logo-mycineworld ">mycineworld</span>
|
49
|
+
</strong>
|
50
|
+
</p>
|
51
|
+
|
52
|
+
<div class="schedule row">
|
53
|
+
<div class="span9">
|
54
|
+
<div class="date row">
|
55
|
+
<div class="span2">
|
56
|
+
<h3>Wednesday 18th Dec</h3>
|
57
|
+
</div>
|
58
|
+
|
59
|
+
<div class="span7">
|
60
|
+
<ol class="performances">
|
61
|
+
<li>
|
62
|
+
<a class="tooltip performance action" title="16:50" href="/booking?cinema=65&filmEdi=445749&date=20131218&time=16:50" rel="nofollow">16:50</a>
|
63
|
+
<div class="tooltip-box performance">
|
64
|
+
<h2>Available screening types:</h2>
|
65
|
+
|
66
|
+
<hr class="thin" />
|
67
|
+
|
68
|
+
<ul class="unstyled">
|
69
|
+
<li class="icon-service-twod">2D</li>
|
70
|
+
</ul>
|
71
|
+
</div>
|
72
|
+
</li>
|
73
|
+
</ol>
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<a class="action secondary light" href="/whatson/6380?cinema=65&date=all">View all dates</a>
|
78
|
+
</div>
|
79
|
+
</div>
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="span2">
|
3
|
+
<div class="poster">
|
4
|
+
<a href="/whatson/6395?cinema=65&date=all">
|
5
|
+
<div class="image">
|
6
|
+
<img src="/cw/assets/images/whatson/film.placeholder.poster.jpg" data-original="/assets/media/films/6395_poster_large.jpg" width="140" alt="Poster for Film RSC Live: Richard II (Encore Performance)" />
|
7
|
+
</div>
|
8
|
+
</a>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="span7">
|
13
|
+
<h1>
|
14
|
+
<a href="/whatson/6395?cinema=65&date=all">RSC Live: Richard II (Encore Performance)</a>
|
15
|
+
<a class="classification gb-12a tooltip" href="/classification" title="No-one younger than 12 may see a '12A' film in a cinema unless accompanied by an adult. Responsibility for allowing under-12s to view lies with the accompanying or supervising adult." data-classification="12A" data-territory="GB">(12A)</a>
|
16
|
+
</h1>
|
17
|
+
|
18
|
+
<div class="inline-children">
|
19
|
+
<h3>Release date:</h3>
|
20
|
+
<p>19th November 2013</p>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="inline-children">
|
24
|
+
<h3>Running time:</h3>
|
25
|
+
<p>180 mins</p>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<h3>Synopsis:</h3>
|
29
|
+
<p>
|
30
|
+
David Tennant stars in the historic first ever live cinema broadcast from the Royal Shakespeare Company's stage.
|
31
|
+
</p>
|
32
|
+
|
33
|
+
<h3>Available screening types</h3>
|
34
|
+
|
35
|
+
<ul class="unstyled">
|
36
|
+
<li class="icon-service-twod"></li>
|
37
|
+
|
38
|
+
</ul>
|
39
|
+
|
40
|
+
<a class="action primary" title="Find out more about RSC Live: Richard II (Encore Performance)" href="/whatson/6395?cinema=65&date=all">Find out more</a>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<br />
|
46
|
+
<p>
|
47
|
+
<strong>
|
48
|
+
Select a showtime and book to save 10% on your tickets with
|
49
|
+
<span class="icon-logo-mycineworld ">mycineworld</span>
|
50
|
+
</strong>
|
51
|
+
</p>
|
52
|
+
|
53
|
+
<div class="schedule row">
|
54
|
+
<div class="span9">
|
55
|
+
<div class="date row">
|
56
|
+
<div class="span2">
|
57
|
+
<h3>Tuesday 19th Nov</h3>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div class="span7">
|
61
|
+
<ol class="performances">
|
62
|
+
<li>
|
63
|
+
<a class="tooltip performance action" title="19:00" href="/booking?cinema=65&filmEdi=445743&date=20131119&time=19:00" rel="nofollow">19:00</a>
|
64
|
+
<div class="tooltip-box performance">
|
65
|
+
<h2>Available screening types:</h2>
|
66
|
+
|
67
|
+
<hr class="thin" />
|
68
|
+
|
69
|
+
<ul class="unstyled">
|
70
|
+
<li class="icon-service-twod">2D</li>
|
71
|
+
</ul>
|
72
|
+
</div>
|
73
|
+
</li>
|
74
|
+
</ol>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
|
78
|
+
<a class="action secondary light" href="/whatson/6395?cinema=65&date=all">View all dates</a>
|
79
|
+
</div>
|
80
|
+
</div>
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="span2">
|
3
|
+
<div class="poster">
|
4
|
+
<a href="/whatson/6916?cinema=65&date=all">
|
5
|
+
<div class="image">
|
6
|
+
<img src="/cw/assets/images/whatson/film.placeholder.poster.jpg" data-original="/assets/media/films/6916_poster_large.jpg" width="140" alt="Poster for Film West End Theatre Series: Noel Coward's Private Lives" />
|
7
|
+
</div>
|
8
|
+
</a>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="span7">
|
13
|
+
<h1>
|
14
|
+
<a href="/whatson/6916?cinema=65&date=all">West End Theatre Series: Noel Coward's Private Lives</a>
|
15
|
+
<a class="classification gb-12a tooltip" href="/classification" title="No-one younger than 12 may see a '12A' film in a cinema unless accompanied by an adult. Responsibility for allowing under-12s to view lies with the accompanying or supervising adult." data-classification="12A" data-territory="GB">(12A)</a>
|
16
|
+
</h1>
|
17
|
+
|
18
|
+
<div class="inline-children">
|
19
|
+
<h3>Release date:</h3>
|
20
|
+
<p>6th February 2014</p>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="inline-children">
|
24
|
+
<h3>Running time:</h3>
|
25
|
+
<p>113 mins</p>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<h3>Synopsis:</h3>
|
29
|
+
<p>
|
30
|
+
Toby Stephens and Anna Chancellor star in the hit West End production of Noel Coward's comic masterpiece.
|
31
|
+
</p>
|
32
|
+
|
33
|
+
<h3>Available screening types</h3>
|
34
|
+
|
35
|
+
<ul class="unstyled">
|
36
|
+
<li class="icon-service-twod"></li>
|
37
|
+
|
38
|
+
</ul>
|
39
|
+
|
40
|
+
<a class="action primary" title="Find out more about West End Theatre Series: Noel Coward's Private Lives" href="/whatson/6916?cinema=65&date=all">Find out more</a>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<br />
|
46
|
+
<p>
|
47
|
+
<strong>
|
48
|
+
Select a showtime and book to save 10% on your tickets with
|
49
|
+
<span class="icon-logo-mycineworld ">mycineworld</span>
|
50
|
+
</strong>
|
51
|
+
</p>
|
52
|
+
|
53
|
+
<div class="schedule row">
|
54
|
+
<div class="span9">
|
55
|
+
<div class="date row">
|
56
|
+
<div class="span2">
|
57
|
+
<h3>Thursday 6th Feb</h3>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div class="span7">
|
61
|
+
<ol class="performances">
|
62
|
+
<li>
|
63
|
+
<a class="tooltip performance action" title="19:30" href="/booking?cinema=65&filmEdi=445941&date=20140206&time=19:30" rel="nofollow">19:30</a>
|
64
|
+
<div class="tooltip-box performance">
|
65
|
+
<h2>Available screening types:</h2>
|
66
|
+
|
67
|
+
<hr class="thin" />
|
68
|
+
|
69
|
+
<ul class="unstyled">
|
70
|
+
<li class="icon-service-twod">2D</li>
|
71
|
+
</ul>
|
72
|
+
</div>
|
73
|
+
</li>
|
74
|
+
</ol>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
|
78
|
+
<a class="action secondary light" href="/whatson/6916?cinema=65&date=all">View all dates</a>
|
79
|
+
</div>
|
80
|
+
</div>
|
@@ -0,0 +1,466 @@
|
|
1
|
+
require_relative '../../test_helper'
|
2
|
+
|
3
|
+
describe CineworldUk::Cinema do
|
4
|
+
|
5
|
+
before { WebMock.disable_net_connect! }
|
6
|
+
|
7
|
+
describe '.all' do
|
8
|
+
subject { CineworldUk::Cinema.all }
|
9
|
+
|
10
|
+
before do
|
11
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas.html') )
|
12
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas').to_return( status: 200, body: body, headers: {} )
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns an Array of CineworldUK::Cinemas' do
|
16
|
+
subject.must_be_instance_of(Array)
|
17
|
+
subject.each do |value|
|
18
|
+
value.must_be_instance_of(CineworldUk::Cinema)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'returns the correctly sized array' do
|
23
|
+
subject.size.must_equal 81
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '.find(id)' do
|
28
|
+
subject { CineworldUk::Cinema.find(id) }
|
29
|
+
|
30
|
+
before do
|
31
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas.html') )
|
32
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas').to_return( status: 200, body: body, headers: {} )
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'Brighton' do
|
36
|
+
let(:id) { 3 }
|
37
|
+
|
38
|
+
it 'returns a cinema' do
|
39
|
+
subject.must_be_instance_of(CineworldUk::Cinema)
|
40
|
+
|
41
|
+
subject.id.must_equal 3
|
42
|
+
subject.brand.must_equal 'Cineworld'
|
43
|
+
subject.name.must_equal 'Brighton'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '.new id, name, url' do
|
49
|
+
it 'stores id, name, slug and url' do
|
50
|
+
cinema = CineworldUk::Cinema.new '3', 'Brighton'
|
51
|
+
cinema.id.must_equal 3
|
52
|
+
cinema.brand.must_equal 'Cineworld'
|
53
|
+
cinema.name.must_equal 'Brighton'
|
54
|
+
cinema.slug.must_equal 'brighton'
|
55
|
+
cinema.url.must_equal 'http://www.cineworld.co.uk/cinemas/3/information'
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'removes "London - " name prefix' do
|
59
|
+
cinema = CineworldUk::Cinema.new 79, 'London - The O2, Greenwich'
|
60
|
+
cinema.id.must_equal 79
|
61
|
+
cinema.name.must_equal 'The O2, Greenwich'
|
62
|
+
cinema.slug.must_equal 'the-o2-greenwich'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '#adr' do
|
67
|
+
subject { cinema.adr }
|
68
|
+
|
69
|
+
describe '(brighton)' do
|
70
|
+
let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
|
71
|
+
|
72
|
+
before do
|
73
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'brighton.html') )
|
74
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/3/information').to_return( status: 200, body: body, headers: {} )
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'returns the address hash' do
|
78
|
+
subject.must_equal({
|
79
|
+
street_address: 'Brighton Marina',
|
80
|
+
extended_address: nil,
|
81
|
+
locality: 'Brighton',
|
82
|
+
region: 'East Sussex',
|
83
|
+
postal_code: 'BN2 5UF',
|
84
|
+
country: 'United Kingdom'
|
85
|
+
})
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe '(bristol)' do
|
90
|
+
let(:cinema) { CineworldUk::Cinema.new('4', 'Bristol') }
|
91
|
+
|
92
|
+
before do
|
93
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'bristol.html') )
|
94
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/4/information').to_return( status: 200, body: body, headers: {} )
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'returns the address hash' do
|
98
|
+
subject.must_equal({
|
99
|
+
street_address: 'Hengrove Leisure Park',
|
100
|
+
extended_address: 'Hengrove Way',
|
101
|
+
locality: 'Bristol',
|
102
|
+
region: nil,
|
103
|
+
postal_code: 'BS14 0HR',
|
104
|
+
country: 'United Kingdom'
|
105
|
+
})
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe '(bury st edmunds)' do
|
110
|
+
let(:cinema) { CineworldUk::Cinema.new('6', 'Bury St. Edmunds') }
|
111
|
+
|
112
|
+
before do
|
113
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'bury-st-edmunds.html') )
|
114
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/6/information').to_return( status: 200, body: body, headers: {} )
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'returns the address hash' do
|
118
|
+
subject.must_equal({
|
119
|
+
street_address: 'Parkway',
|
120
|
+
extended_address: nil,
|
121
|
+
locality: 'Bury St. Edmunds',
|
122
|
+
region: nil,
|
123
|
+
postal_code: 'IP33 3BA',
|
124
|
+
country: 'United Kingdom'
|
125
|
+
})
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe '(london chelsea)' do
|
130
|
+
let(:cinema) { CineworldUk::Cinema.new('10', 'London - Chelsea') }
|
131
|
+
|
132
|
+
before do
|
133
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'chelsea.html') )
|
134
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/10/information').to_return( status: 200, body: body, headers: {} )
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'returns the address hash' do
|
138
|
+
subject.must_equal({
|
139
|
+
street_address: '279 Kings Road',
|
140
|
+
extended_address: 'Chelsea',
|
141
|
+
locality: 'London',
|
142
|
+
region: nil,
|
143
|
+
postal_code: 'SW3 5EW',
|
144
|
+
country: 'United Kingdom'
|
145
|
+
})
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
describe '(london o2)' do
|
150
|
+
let(:cinema) { CineworldUk::Cinema.new('79', 'The O2, Grenwich') }
|
151
|
+
|
152
|
+
before do
|
153
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'the-o2-grenwich.html') )
|
154
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/79/information').to_return( status: 200, body: body, headers: {} )
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'returns the address hash' do
|
158
|
+
subject.must_equal({
|
159
|
+
street_address: 'The O2',
|
160
|
+
extended_address: 'Peninsula Square',
|
161
|
+
locality: 'London',
|
162
|
+
region: nil,
|
163
|
+
postal_code: 'SE10 0DX',
|
164
|
+
country: 'United Kingdom'
|
165
|
+
})
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
describe '#extended_address' do
|
171
|
+
subject { cinema.extended_address }
|
172
|
+
|
173
|
+
describe '(brighton)' do
|
174
|
+
let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
|
175
|
+
|
176
|
+
before do
|
177
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'brighton.html') )
|
178
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/3/information').to_return( status: 200, body: body, headers: {} )
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'returns nil' do
|
182
|
+
subject.must_be_nil
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
describe '(bristol)' do
|
187
|
+
let(:cinema) { CineworldUk::Cinema.new('4', 'Bristol') }
|
188
|
+
|
189
|
+
before do
|
190
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'bristol.html') )
|
191
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/4/information').to_return( status: 200, body: body, headers: {} )
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'returns the second line' do
|
195
|
+
subject.must_equal 'Hengrove Way'
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
describe '(bury st edmunds)' do
|
200
|
+
let(:cinema) { CineworldUk::Cinema.new('6', 'Bury St. Edmunds') }
|
201
|
+
|
202
|
+
before do
|
203
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'bury-st-edmunds.html') )
|
204
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/6/information').to_return( status: 200, body: body, headers: {} )
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'returns the town/city' do
|
208
|
+
subject.must_be_nil
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe '(london chelsea)' do
|
213
|
+
let(:cinema) { CineworldUk::Cinema.new('10', 'London - Chelsea') }
|
214
|
+
|
215
|
+
before do
|
216
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'chelsea.html') )
|
217
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/10/information').to_return( status: 200, body: body, headers: {} )
|
218
|
+
end
|
219
|
+
|
220
|
+
it 'returns the second line' do
|
221
|
+
subject.must_equal 'Chelsea'
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
describe '(london o2)' do
|
226
|
+
let(:cinema) { CineworldUk::Cinema.new('79', 'The O2, Grenwich') }
|
227
|
+
|
228
|
+
before do
|
229
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'the-o2-grenwich.html') )
|
230
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/79/information').to_return( status: 200, body: body, headers: {} )
|
231
|
+
end
|
232
|
+
|
233
|
+
it 'returns the second line' do
|
234
|
+
subject.must_equal 'Peninsula Square'
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
describe '#films' do
|
240
|
+
let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
|
241
|
+
subject { cinema.films }
|
242
|
+
|
243
|
+
before do
|
244
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'whatson', 'brighton.html') )
|
245
|
+
stub_request(:get, 'http://www.cineworld.co.uk/whatson?cinema=3').to_return( status: 200, body: body, headers: {} )
|
246
|
+
end
|
247
|
+
|
248
|
+
it 'returns an array of films' do
|
249
|
+
subject.must_be_instance_of(Array)
|
250
|
+
subject.each do |item|
|
251
|
+
item.must_be_instance_of(CineworldUk::Film)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
it 'returns correct number of films' do
|
256
|
+
subject.count.must_equal 24
|
257
|
+
end
|
258
|
+
|
259
|
+
it 'returns uniquely named films' do
|
260
|
+
subject.each_with_index do |item, index|
|
261
|
+
subject.each_with_index do |jtem, i|
|
262
|
+
if index != i
|
263
|
+
item.name.wont_equal jtem.name
|
264
|
+
item.wont_equal jtem
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
it 'returns film objects with correct names' do
|
271
|
+
subject.first.name.must_equal 'Gravity'
|
272
|
+
subject.last.name.must_equal 'Don Jon'
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
describe '#locality' do
|
277
|
+
subject { cinema.locality }
|
278
|
+
|
279
|
+
describe '(brighton)' do
|
280
|
+
let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
|
281
|
+
|
282
|
+
before do
|
283
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'brighton.html') )
|
284
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/3/information').to_return( status: 200, body: body, headers: {} )
|
285
|
+
end
|
286
|
+
|
287
|
+
it 'returns the town/city' do
|
288
|
+
subject.must_equal 'Brighton'
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
describe '(bristol)' do
|
293
|
+
let(:cinema) { CineworldUk::Cinema.new('4', 'Bristol') }
|
294
|
+
|
295
|
+
before do
|
296
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'bristol.html') )
|
297
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/4/information').to_return( status: 200, body: body, headers: {} )
|
298
|
+
end
|
299
|
+
|
300
|
+
it 'returns the town/city' do
|
301
|
+
subject.must_equal 'Bristol'
|
302
|
+
end
|
303
|
+
end
|
304
|
+
|
305
|
+
describe '(bury st edmunds)' do
|
306
|
+
let(:cinema) { CineworldUk::Cinema.new('6', 'Bury St. Edmunds') }
|
307
|
+
|
308
|
+
before do
|
309
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'bury-st-edmunds.html') )
|
310
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/6/information').to_return( status: 200, body: body, headers: {} )
|
311
|
+
end
|
312
|
+
|
313
|
+
it 'returns the town/city' do
|
314
|
+
subject.must_equal 'Bury St. Edmunds'
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
describe '(london chelsea)' do
|
319
|
+
let(:cinema) { CineworldUk::Cinema.new('10', 'London - Chelsea') }
|
320
|
+
|
321
|
+
before do
|
322
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'chelsea.html') )
|
323
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/10/information').to_return( status: 200, body: body, headers: {} )
|
324
|
+
end
|
325
|
+
|
326
|
+
it 'returns the town/city' do
|
327
|
+
subject.must_equal 'London'
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
describe '(london o2)' do
|
332
|
+
let(:cinema) { CineworldUk::Cinema.new('79', 'The O2, Grenwich') }
|
333
|
+
|
334
|
+
before do
|
335
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'the-o2-grenwich.html') )
|
336
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/79/information').to_return( status: 200, body: body, headers: {} )
|
337
|
+
end
|
338
|
+
|
339
|
+
it 'returns the town/city' do
|
340
|
+
subject.must_equal 'London'
|
341
|
+
end
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
describe '#postal_code' do
|
346
|
+
subject { cinema.postal_code }
|
347
|
+
|
348
|
+
describe '(brighton)' do
|
349
|
+
let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
|
350
|
+
|
351
|
+
before do
|
352
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'brighton.html') )
|
353
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/3/information').to_return( status: 200, body: body, headers: {} )
|
354
|
+
end
|
355
|
+
|
356
|
+
it 'returns the post code' do
|
357
|
+
subject.must_equal 'BN2 5UF'
|
358
|
+
end
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
describe '#region' do
|
363
|
+
subject { cinema.region }
|
364
|
+
|
365
|
+
describe '(brighton)' do
|
366
|
+
let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
|
367
|
+
|
368
|
+
before do
|
369
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'brighton.html') )
|
370
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/3/information').to_return( status: 200, body: body, headers: {} )
|
371
|
+
end
|
372
|
+
|
373
|
+
it 'returns the county' do
|
374
|
+
subject.must_equal 'East Sussex'
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
describe '(bristol)' do
|
379
|
+
let(:cinema) { CineworldUk::Cinema.new('4', 'Bristol') }
|
380
|
+
|
381
|
+
before do
|
382
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'bristol.html') )
|
383
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/4/information').to_return( status: 200, body: body, headers: {} )
|
384
|
+
end
|
385
|
+
|
386
|
+
it 'returns nil' do
|
387
|
+
subject.must_be_nil
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
describe '(bury st edmunds)' do
|
392
|
+
let(:cinema) { CineworldUk::Cinema.new('6', 'Bury St. Edmunds') }
|
393
|
+
|
394
|
+
before do
|
395
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'bury-st-edmunds.html') )
|
396
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/6/information').to_return( status: 200, body: body, headers: {} )
|
397
|
+
end
|
398
|
+
|
399
|
+
it 'returns nil' do
|
400
|
+
subject.must_be_nil
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
describe '(london o2)' do
|
405
|
+
let(:cinema) { CineworldUk::Cinema.new('79', 'The O2, Grenwich') }
|
406
|
+
|
407
|
+
before do
|
408
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'the-o2-grenwich.html') )
|
409
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/79/information').to_return( status: 200, body: body, headers: {} )
|
410
|
+
end
|
411
|
+
|
412
|
+
it 'returns nil' do
|
413
|
+
subject.must_be_nil
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
end
|
418
|
+
|
419
|
+
describe '#screenings' do
|
420
|
+
let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
|
421
|
+
subject { cinema.screenings }
|
422
|
+
|
423
|
+
before do
|
424
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'whatson', 'brighton.html') )
|
425
|
+
stub_request(:get, 'http://www.cineworld.co.uk/whatson?cinema=3').to_return( status: 200, body: body, headers: {} )
|
426
|
+
end
|
427
|
+
|
428
|
+
it 'returns an array of screenings' do
|
429
|
+
subject.must_be_instance_of(Array)
|
430
|
+
subject.each do |item|
|
431
|
+
item.must_be_instance_of(CineworldUk::Screening)
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
it 'returns screening objects with correct film names' do
|
436
|
+
subject.first.film_name.must_equal 'Gravity'
|
437
|
+
subject.last.film_name.must_equal 'Don Jon'
|
438
|
+
end
|
439
|
+
|
440
|
+
it 'returns screening objects with correct cinema name' do
|
441
|
+
subject.each { |screening| screening.cinema_name.must_equal 'Brighton' }
|
442
|
+
end
|
443
|
+
|
444
|
+
it 'returns screening objects with correct UTC times' do
|
445
|
+
subject.first.when.must_equal Time.utc(2013, 11, 13, 12, 0, 0)
|
446
|
+
subject.last.when.must_equal Time.utc(2013, 11, 21, 21, 30, 0)
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
describe '#street_address' do
|
451
|
+
subject { cinema.street_address }
|
452
|
+
|
453
|
+
describe '(brighton)' do
|
454
|
+
let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
|
455
|
+
|
456
|
+
before do
|
457
|
+
body = File.read( File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'cinemas', 'brighton.html') )
|
458
|
+
stub_request(:get, 'http://www.cineworld.co.uk/cinemas/3/information').to_return( status: 200, body: body, headers: {} )
|
459
|
+
end
|
460
|
+
|
461
|
+
it 'returns the street address' do
|
462
|
+
subject.must_equal 'Brighton Marina'
|
463
|
+
end
|
464
|
+
end
|
465
|
+
end
|
466
|
+
end
|