cineworld_uk 2.1.6 → 3.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 +4 -4
- data/CHANGELOG.md +22 -3
- data/README.md +56 -14
- data/Rakefile +57 -1
- data/cineworld_uk.gemspec +1 -2
- data/lib/cineworld_uk/cinema.rb +113 -182
- data/lib/cineworld_uk/internal/api_response.rb +74 -0
- data/lib/cineworld_uk/internal/parser/api/cinema_address.rb +81 -0
- data/lib/cineworld_uk/internal/parser/api/film.rb +46 -0
- data/lib/cineworld_uk/internal/parser/api/film_lookup.rb +38 -0
- data/lib/cineworld_uk/internal/parser/api/performance.rb +46 -0
- data/lib/cineworld_uk/internal/parser/api/performances_by_day.rb +50 -0
- data/lib/cineworld_uk/internal/title_sanitizer.rb +56 -52
- data/lib/cineworld_uk/performance.rb +78 -0
- data/lib/cineworld_uk/version.rb +2 -2
- data/lib/cineworld_uk.rb +11 -8
- data/test/fixtures/api/cinema-detail-10.json +1 -0
- data/test/fixtures/api/cinema-detail-21.json +1 -0
- data/test/fixtures/api/cinema-detail-3.json +1 -0
- data/test/fixtures/api/cinema-detail-96.json +1 -0
- data/test/fixtures/api/cinema-list.json +1 -0
- data/test/fixtures/api/dates-3.json +1 -0
- data/test/fixtures/api/film-list-comingsoon.json +1 -0
- data/test/fixtures/api/film-list.json +1 -0
- data/test/fixtures/api/performances-tomorrow-3.json +1 -0
- data/test/lib/cineworld_uk/cinema_test.rb +96 -197
- data/test/lib/cineworld_uk/internal/api_response_test.rb +85 -0
- data/test/lib/cineworld_uk/internal/parser/api/cinema_address_test.rb +93 -0
- data/test/lib/cineworld_uk/internal/parser/api/film_lookup_test.rb +30 -0
- data/test/lib/cineworld_uk/internal/parser/api/film_test.rb +169 -0
- data/test/lib/cineworld_uk/internal/parser/api/performance_test.rb +62 -0
- data/test/lib/cineworld_uk/internal/title_sanitizer_test.rb +1 -1
- data/test/lib/cineworld_uk/{screening_test.rb → performance_test.rb} +36 -48
- data/test/support/fixture_reader.rb +44 -0
- metadata +48 -59
- data/lib/cineworld_uk/film.rb +0 -65
- data/lib/cineworld_uk/internal/film_with_screenings_parser.rb +0 -69
- data/lib/cineworld_uk/internal/screening_parser.rb +0 -132
- data/lib/cineworld_uk/internal/website.rb +0 -35
- data/lib/cineworld_uk/internal/whatson_parser.rb +0 -36
- data/lib/cineworld_uk/screening.rb +0 -87
- data/test/fixture_updater.rb +0 -64
- data/test/fixtures/cinemas.html +0 -513
- data/test/fixtures/information/brighton.html +0 -1268
- data/test/fixtures/information/bristol.html +0 -1265
- data/test/fixtures/whatson/brighton/film_first.html +0 -207
- data/test/fixtures/whatson/brighton/film_last.html +0 -62
- data/test/fixtures/whatson/brighton/film_second.html +0 -347
- data/test/fixtures/whatson/brighton.html +0 -7508
- data/test/fixtures/whatson/glasgow-imax-at-gsc/film_first.html +0 -182
- data/test/fixtures/whatson/the-o2-greenwich/film_first.html +0 -167
- data/test/lib/cineworld_uk/film_test.rb +0 -142
- data/test/lib/cineworld_uk/internal/film_with_screenings_parser_test.rb +0 -101
- data/test/lib/cineworld_uk/internal/website_test.rb +0 -57
- data/test/lib/cineworld_uk/internal/whatson_parser_test.rb +0 -58
@@ -1,182 +0,0 @@
|
|
1
|
-
<div class="film">
|
2
|
-
<div class="row">
|
3
|
-
<div class="span4">
|
4
|
-
<div class="poster ">
|
5
|
-
<a href="/whatson/lucy?cinema=88&date=all">
|
6
|
-
<div class="image"><img src="/cw/assets/images/whatson/film.placeholder.poster.jpg" data-original="/assets/media/films/7622_poster_iphone.jpg" width="300" alt="Poster for Film Lucy"></div>
|
7
|
-
</a>
|
8
|
-
</div>
|
9
|
-
</div>
|
10
|
-
<div class="span5">
|
11
|
-
<h3 class="h1">
|
12
|
-
<a href="/whatson/lucy?cinema=88&date=all">Lucy</a>
|
13
|
-
<a class="classification gb-15 tooltip" href="/classification" title="No-one younger than 15 may see a '15' film in a cinema." data-classification="15" data-territory="GB">(15)</a>
|
14
|
-
</h3>
|
15
|
-
<div class="inline-children">
|
16
|
-
<h3>Release date:</h3>
|
17
|
-
<p>22nd August 2014</p>
|
18
|
-
</div>
|
19
|
-
<div class="inline-children">
|
20
|
-
<h3>Running time:</h3> <p>89 mins</p>
|
21
|
-
</div>
|
22
|
-
<h3>Synopsis:</h3>
|
23
|
-
<p>Scarlett Johansson stars in a breathtaking action-thriller about a woman who accidentally develops superhuman powers.</p>
|
24
|
-
<h3>Cast:</h3>
|
25
|
-
<p>Scarlett Johansson, Morgan Freeman</p>
|
26
|
-
<h3>Director:</h3>
|
27
|
-
<p>Luc Besson</p>
|
28
|
-
<h3>Available screening types</h3>
|
29
|
-
<ul class="unstyled">
|
30
|
-
<li class="icon-service-2d">
|
31
|
-
<li class="icon-service-ix">
|
32
|
-
</ul>
|
33
|
-
<a class="action primary" title="Find out more about Lucy" href="/whatson/lucy?cinema=88&date=all">Find out more</a>
|
34
|
-
</div>
|
35
|
-
</div>
|
36
|
-
<br>
|
37
|
-
<p><strong>Book your tickets faster and easier when you register your details with <span class="icon-logo-mycineworld ">mycineworld</span>
|
38
|
-
</strong></p>
|
39
|
-
<div class="schedule row">
|
40
|
-
<div class="span9">
|
41
|
-
<div class="row day">
|
42
|
-
<div class="span2">
|
43
|
-
<h3>Friday 5th Sep</h3>
|
44
|
-
</div>
|
45
|
-
<div class="span7">
|
46
|
-
<ol class="performances">
|
47
|
-
<li>
|
48
|
-
<span class="tooltip performance action unavailable" data-tooltip-template="performance-unavailable" data-field-title="" data-field-explanation="">21:15</span>
|
49
|
-
</li>
|
50
|
-
</ol>
|
51
|
-
</div>
|
52
|
-
</div>
|
53
|
-
<div class="row day">
|
54
|
-
<div class="span2">
|
55
|
-
<h3>Saturday 6th Sep</h3>
|
56
|
-
</div>
|
57
|
-
<div class="span7">
|
58
|
-
<ol class="performances">
|
59
|
-
<li>
|
60
|
-
<a class="tooltip performance action" title="18:30" href="/booking?cinema=88&filmEdi=158954&date=20140906&time=18:30" rel="nofollow" data-datetime="201409061830">18:30</a>
|
61
|
-
<div class="tooltip-box performance">
|
62
|
-
<h3>Available screening types:</h3>
|
63
|
-
<hr class="thin">
|
64
|
-
<ul class="unstyled">
|
65
|
-
<li class="icon-service-ix">IMAX</li>
|
66
|
-
<li class="icon-service-2d">2D</li>
|
67
|
-
</ul>
|
68
|
-
</div>
|
69
|
-
</li>
|
70
|
-
</ol>
|
71
|
-
</div>
|
72
|
-
</div>
|
73
|
-
<div class="row day">
|
74
|
-
<div class="span2">
|
75
|
-
<h3>Monday 8th Sep</h3>
|
76
|
-
</div>
|
77
|
-
<div class="span7">
|
78
|
-
<ol class="performances">
|
79
|
-
<li>
|
80
|
-
<a class="tooltip performance action" title="18:00" href="/booking?cinema=88&filmEdi=158954&date=20140908&time=18:00" rel="nofollow" data-datetime="201409081800">18:00</a>
|
81
|
-
<div class="tooltip-box performance">
|
82
|
-
<h3>Available screening types:</h3>
|
83
|
-
<hr class="thin">
|
84
|
-
<ul class="unstyled">
|
85
|
-
<li class="icon-service-ix">IMAX</li>
|
86
|
-
<li class="icon-service-2d">2D</li>
|
87
|
-
</ul>
|
88
|
-
</div>
|
89
|
-
</li>
|
90
|
-
<li>
|
91
|
-
<a class="tooltip performance action" title="20:45" href="/booking?cinema=88&filmEdi=158954&date=20140908&time=20:45" rel="nofollow" data-datetime="201409082045">20:45</a>
|
92
|
-
<div class="tooltip-box performance">
|
93
|
-
<h3>Available screening types:</h3>
|
94
|
-
<hr class="thin">
|
95
|
-
<ul class="unstyled">
|
96
|
-
<li class="icon-service-ix">IMAX</li>
|
97
|
-
<li class="icon-service-2d">2D</li>
|
98
|
-
</ul>
|
99
|
-
</div>
|
100
|
-
</li>
|
101
|
-
</ol>
|
102
|
-
</div>
|
103
|
-
</div>
|
104
|
-
<div class="row day">
|
105
|
-
<div class="span2">
|
106
|
-
<h3>Tuesday 9th Sep</h3>
|
107
|
-
</div>
|
108
|
-
<div class="span7">
|
109
|
-
<ol class="performances">
|
110
|
-
<li>
|
111
|
-
<a class="tooltip performance action" title="18:00" href="/booking?cinema=88&filmEdi=158954&date=20140909&time=18:00" rel="nofollow" data-datetime="201409091800">18:00</a>
|
112
|
-
<div class="tooltip-box performance">
|
113
|
-
<h3>Available screening types:</h3>
|
114
|
-
<hr class="thin">
|
115
|
-
<ul class="unstyled">
|
116
|
-
<li class="icon-service-ix">IMAX</li>
|
117
|
-
<li class="icon-service-2d">2D</li>
|
118
|
-
</ul>
|
119
|
-
</div>
|
120
|
-
</li>
|
121
|
-
<li>
|
122
|
-
<a class="tooltip performance action" title="20:45" href="/booking?cinema=88&filmEdi=158954&date=20140909&time=20:45" rel="nofollow" data-datetime="201409092045">20:45</a>
|
123
|
-
<div class="tooltip-box performance">
|
124
|
-
<h3>Available screening types:</h3>
|
125
|
-
<hr class="thin">
|
126
|
-
<ul class="unstyled">
|
127
|
-
<li class="icon-service-ix">IMAX</li>
|
128
|
-
<li class="icon-service-2d">2D</li>
|
129
|
-
</ul>
|
130
|
-
</div>
|
131
|
-
</li>
|
132
|
-
</ol>
|
133
|
-
</div>
|
134
|
-
</div>
|
135
|
-
<div class="row day">
|
136
|
-
<div class="span2">
|
137
|
-
<h3>Wednesday 10th Sep</h3>
|
138
|
-
</div>
|
139
|
-
<div class="span7">
|
140
|
-
<ol class="performances">
|
141
|
-
<li>
|
142
|
-
<a class="tooltip performance action" title="20:45" href="/booking?cinema=88&filmEdi=158954&date=20140910&time=20:45" rel="nofollow" data-datetime="201409102045">20:45</a>
|
143
|
-
<div class="tooltip-box performance">
|
144
|
-
<h3>Available screening types:</h3>
|
145
|
-
<hr class="thin">
|
146
|
-
<ul class="unstyled">
|
147
|
-
<li class="icon-service-ix">IMAX</li>
|
148
|
-
<li class="icon-service-2d">2D</li>
|
149
|
-
</ul>
|
150
|
-
</div>
|
151
|
-
</li>
|
152
|
-
</ol>
|
153
|
-
</div>
|
154
|
-
</div>
|
155
|
-
<div class="row day">
|
156
|
-
<div class="span2">
|
157
|
-
<h3>Thursday 11th Sep</h3>
|
158
|
-
</div>
|
159
|
-
<div class="span7">
|
160
|
-
<ol class="performances">
|
161
|
-
<li>
|
162
|
-
<a class="tooltip performance action" title="20:45" href="/booking?cinema=88&filmEdi=158954&date=20140911&time=20:45" rel="nofollow" data-datetime="201409112045">20:45</a>
|
163
|
-
<div class="tooltip-box performance">
|
164
|
-
<h3>Available screening types:</h3>
|
165
|
-
<hr class="thin">
|
166
|
-
<ul class="unstyled">
|
167
|
-
<li class="icon-service-ix">IMAX</li>
|
168
|
-
<li class="icon-service-2d">2D</li>
|
169
|
-
</ul>
|
170
|
-
</div>
|
171
|
-
</li>
|
172
|
-
</ol>
|
173
|
-
</div>
|
174
|
-
</div>
|
175
|
-
<a class="action secondary light" href="/whatson/lucy?cinema=88&date=all">View all dates</a>
|
176
|
-
<span class="share-film-times" style="display: none;" data-film-id="7622" data-film-title="Lucy" data-film-slug="lucy" data-film-url="/whatson/lucy" data-cinema-id="88">
|
177
|
-
<a href="/login?location=%2Fwhatson%3Fcinema%3D88%26date%3Dall">Login</a> or <a href="/register?location=%2Fwhatson%3Fcinema%3D88%26date%3Dall">register</a> to share these times with friends.
|
178
|
-
</span>
|
179
|
-
</div>
|
180
|
-
</div>
|
181
|
-
<hr>
|
182
|
-
</div>
|
@@ -1,167 +0,0 @@
|
|
1
|
-
<div class="film">
|
2
|
-
<div class="row">
|
3
|
-
<div class="span4">
|
4
|
-
<div class="poster has-ribbon">
|
5
|
-
<a href="/whatson/the-boxtrolls?cinema=79&date=all">
|
6
|
-
<div class="overlay ribbon blue">Previews Sept 06 & 07</div>
|
7
|
-
<div class="image"><img src="/cw/assets/images/whatson/film.placeholder.poster.jpg" data-original="/assets/media/films/7705_poster_iphone.jpg" width="300" alt="Poster for Film The Boxtrolls"></div>
|
8
|
-
</a>
|
9
|
-
</div>
|
10
|
-
</div>
|
11
|
-
<div class="span5">
|
12
|
-
<h3 class="h1">
|
13
|
-
<a href="/whatson/the-boxtrolls?cinema=79&date=all">The Boxtrolls</a>
|
14
|
-
<a class="classification gb-pg tooltip" href="/classification" title="Unaccompanied children of any age may watch. A 'PG' film should not disturb a child aged around eight or older. However, parents are advised to consider whether the content may upset younger or more sensitive children." data-classification="PG" data-territory="GB">(PG)</a>
|
15
|
-
</h3>
|
16
|
-
<div class="inline-children">
|
17
|
-
<h3>Release date:</h3>
|
18
|
-
<p>12th September 2014</p>
|
19
|
-
</div>
|
20
|
-
<div class="inline-children">
|
21
|
-
<h3>Running time:</h3> <p>97 mins</p>
|
22
|
-
</div>
|
23
|
-
<h3>Synopsis:</h3>
|
24
|
-
<p>An orphan boy leads his quirky family of subterranean critters into battle with an evil villain in this fun-packed family animation.</p>
|
25
|
-
<h3>Cast:</h3>
|
26
|
-
<p>Sir Ben Kingsley, Isaac Hempstead-Wright, Elle Fanning, Tracy Morgan, Richard Ayoade, Nick Frost, Jared Harris, Toni Collette, Simon Pegg</p>
|
27
|
-
<h3>Director:</h3>
|
28
|
-
<p>Graham Annable, Anthony Stacchi</p>
|
29
|
-
<h3>Available screening types</h3>
|
30
|
-
<ul class="unstyled">
|
31
|
-
<li class="icon-service-2d">
|
32
|
-
<li class="icon-service-3d">
|
33
|
-
</ul>
|
34
|
-
<a class="action primary" title="Find out more about The Boxtrolls" href="/whatson/the-boxtrolls?cinema=79&date=all">Find out more</a>
|
35
|
-
</div>
|
36
|
-
</div>
|
37
|
-
<br>
|
38
|
-
<p><strong>Book your tickets faster and easier when you register your details with <span class="icon-logo-mycineworld ">mycineworld</span>
|
39
|
-
</strong></p>
|
40
|
-
<div class="schedule row">
|
41
|
-
<div class="span9">
|
42
|
-
<div class="row day">
|
43
|
-
<div class="span2">
|
44
|
-
<h3>Saturday 6th Sep</h3>
|
45
|
-
</div>
|
46
|
-
<div class="span7">
|
47
|
-
<ol class="performances">
|
48
|
-
<li>
|
49
|
-
<a class="tooltip performance action" title="10:45" href="/booking?cinema=79&filmEdi=134706&date=20140906&time=10:45" rel="nofollow" data-datetime="201409061045">10:45</a>
|
50
|
-
<div class="tooltip-box performance">
|
51
|
-
<h3>Available screening types:</h3>
|
52
|
-
<hr class="thin">
|
53
|
-
<ul class="unstyled">
|
54
|
-
<li class="icon-service-3d">3D</li>
|
55
|
-
</ul>
|
56
|
-
</div>
|
57
|
-
</li>
|
58
|
-
<li>
|
59
|
-
<a class="tooltip performance action" title="12:00" href="/booking?cinema=79&filmEdi=134706&date=20140906&time=12:00" rel="nofollow" data-datetime="201409061200">12:00</a>
|
60
|
-
<div class="tooltip-box performance">
|
61
|
-
<h3>Available screening types:</h3>
|
62
|
-
<hr class="thin">
|
63
|
-
<ul class="unstyled">
|
64
|
-
<li class="icon-service-2d">2D</li>
|
65
|
-
</ul>
|
66
|
-
</div>
|
67
|
-
</li>
|
68
|
-
<li>
|
69
|
-
<a class="tooltip performance action" title="13:15" href="/booking?cinema=79&filmEdi=134706&date=20140906&time=13:15" rel="nofollow" data-datetime="201409061315">13:15</a>
|
70
|
-
<div class="tooltip-box performance">
|
71
|
-
<h3>Available screening types:</h3>
|
72
|
-
<hr class="thin">
|
73
|
-
<ul class="unstyled">
|
74
|
-
<li class="icon-service-3d">3D</li>
|
75
|
-
</ul>
|
76
|
-
</div>
|
77
|
-
</li>
|
78
|
-
<li>
|
79
|
-
<a class="tooltip performance action" title="14:30" href="/booking?cinema=79&filmEdi=134706&date=20140906&time=14:30" rel="nofollow" data-datetime="201409061430">14:30</a>
|
80
|
-
<div class="tooltip-box performance">
|
81
|
-
<h3>Available screening types:</h3>
|
82
|
-
<hr class="thin">
|
83
|
-
<ul class="unstyled">
|
84
|
-
<li class="icon-service-2d">2D</li>
|
85
|
-
</ul>
|
86
|
-
</div>
|
87
|
-
</li>
|
88
|
-
<li>
|
89
|
-
<a class="tooltip performance action" title="15:45" href="/booking?cinema=79&filmEdi=134706&date=20140906&time=15:45" rel="nofollow" data-datetime="201409061545">15:45</a>
|
90
|
-
<div class="tooltip-box performance">
|
91
|
-
<h3>Available screening types:</h3>
|
92
|
-
<hr class="thin">
|
93
|
-
<ul class="unstyled">
|
94
|
-
<li class="icon-service-3d">3D</li>
|
95
|
-
</ul>
|
96
|
-
</div>
|
97
|
-
</li>
|
98
|
-
</ol>
|
99
|
-
</div>
|
100
|
-
</div>
|
101
|
-
<div class="row day">
|
102
|
-
<div class="span2">
|
103
|
-
<h3>Sunday 7th Sep</h3>
|
104
|
-
</div>
|
105
|
-
<div class="span7">
|
106
|
-
<ol class="performances">
|
107
|
-
<li>
|
108
|
-
<a class="tooltip performance action" title="10:45" href="/booking?cinema=79&filmEdi=134706&date=20140907&time=10:45" rel="nofollow" data-datetime="201409071045">10:45</a>
|
109
|
-
<div class="tooltip-box performance">
|
110
|
-
<h3>Available screening types:</h3>
|
111
|
-
<hr class="thin">
|
112
|
-
<ul class="unstyled">
|
113
|
-
<li class="icon-service-3d">3D</li>
|
114
|
-
</ul>
|
115
|
-
</div>
|
116
|
-
</li>
|
117
|
-
<li>
|
118
|
-
<a class="tooltip performance action" title="12:00" href="/booking?cinema=79&filmEdi=134706&date=20140907&time=12:00" rel="nofollow" data-datetime="201409071200">12:00</a>
|
119
|
-
<div class="tooltip-box performance">
|
120
|
-
<h3>Available screening types:</h3>
|
121
|
-
<hr class="thin">
|
122
|
-
<ul class="unstyled">
|
123
|
-
<li class="icon-service-2d">2D</li>
|
124
|
-
</ul>
|
125
|
-
</div>
|
126
|
-
</li>
|
127
|
-
<li>
|
128
|
-
<a class="tooltip performance action" title="13:15" href="/booking?cinema=79&filmEdi=134706&date=20140907&time=13:15" rel="nofollow" data-datetime="201409071315">13:15</a>
|
129
|
-
<div class="tooltip-box performance">
|
130
|
-
<h3>Available screening types:</h3>
|
131
|
-
<hr class="thin">
|
132
|
-
<ul class="unstyled">
|
133
|
-
<li class="icon-service-3d">3D</li>
|
134
|
-
</ul>
|
135
|
-
</div>
|
136
|
-
</li>
|
137
|
-
<li>
|
138
|
-
<a class="tooltip performance action" title="14:30" href="/booking?cinema=79&filmEdi=134706&date=20140907&time=14:30" rel="nofollow" data-datetime="201409071430">14:30</a>
|
139
|
-
<div class="tooltip-box performance">
|
140
|
-
<h3>Available screening types:</h3>
|
141
|
-
<hr class="thin">
|
142
|
-
<ul class="unstyled">
|
143
|
-
<li class="icon-service-2d">2D</li>
|
144
|
-
</ul>
|
145
|
-
</div>
|
146
|
-
</li>
|
147
|
-
<li>
|
148
|
-
<a class="tooltip performance action" title="15:45" href="/booking?cinema=79&filmEdi=134706&date=20140907&time=15:45" rel="nofollow" data-datetime="201409071545">15:45</a>
|
149
|
-
<div class="tooltip-box performance">
|
150
|
-
<h3>Available screening types:</h3>
|
151
|
-
<hr class="thin">
|
152
|
-
<ul class="unstyled">
|
153
|
-
<li class="icon-service-3d">3D</li>
|
154
|
-
</ul>
|
155
|
-
</div>
|
156
|
-
</li>
|
157
|
-
</ol>
|
158
|
-
</div>
|
159
|
-
</div>
|
160
|
-
<a class="action secondary light" href="/whatson/the-boxtrolls?cinema=79&date=all">View all dates</a>
|
161
|
-
<span class="share-film-times" style="display: none;" data-film-id="7705" data-film-title="The Boxtrolls" data-film-slug="the-boxtrolls" data-film-url="/whatson/the-boxtrolls" data-cinema-id="79">
|
162
|
-
<a href="/login?location=%2Fwhatson%3Fcinema%3D79%26date%3Dall">Login</a> or <a href="/register?location=%2Fwhatson%3Fcinema%3D79%26date%3Dall">register</a> to share these times with friends.
|
163
|
-
</span>
|
164
|
-
</div>
|
165
|
-
</div>
|
166
|
-
<hr>
|
167
|
-
</div>
|
@@ -1,142 +0,0 @@
|
|
1
|
-
require_relative '../../test_helper'
|
2
|
-
|
3
|
-
describe CineworldUk::Film do
|
4
|
-
|
5
|
-
before { WebMock.disable_net_connect! }
|
6
|
-
|
7
|
-
describe '.new(name)' do
|
8
|
-
it 'stores name' do
|
9
|
-
film = CineworldUk::Film.new 'Iron Man 3'
|
10
|
-
film.name.must_equal 'Iron Man 3'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '.at(cinema_id)' do
|
15
|
-
let(:website) { Minitest::Mock.new }
|
16
|
-
|
17
|
-
subject { CineworldUk::Film.at(3) }
|
18
|
-
|
19
|
-
before do
|
20
|
-
website.expect(:whatson, whatson_html('brighton'), [3])
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'returns an array of films' do
|
24
|
-
CineworldUk::Internal::Website.stub :new, website do
|
25
|
-
subject.must_be_instance_of(Array)
|
26
|
-
subject.each do |film|
|
27
|
-
film.must_be_instance_of(CineworldUk::Film)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'returns a decent number of films' do
|
33
|
-
CineworldUk::Internal::Website.stub :new, website do
|
34
|
-
subject.count.must_be :>, 15
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'returns uniquely named films' do
|
39
|
-
CineworldUk::Internal::Website.stub :new, website do
|
40
|
-
subject.each_with_index do |item, index|
|
41
|
-
subject.each_with_index do |jtem, i|
|
42
|
-
next if index == i
|
43
|
-
item.name.wont_equal jtem.name
|
44
|
-
item.wont_equal jtem
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe 'Comparable' do
|
52
|
-
it 'includes comparable methods' do
|
53
|
-
film = CineworldUk::Film.new 'AAAA'
|
54
|
-
film.methods.must_include :<
|
55
|
-
film.methods.must_include :>
|
56
|
-
film.methods.must_include :==
|
57
|
-
film.methods.must_include :<=>
|
58
|
-
film.methods.must_include :<=
|
59
|
-
film.methods.must_include :>=
|
60
|
-
end
|
61
|
-
|
62
|
-
describe 'uniqueness' do
|
63
|
-
it 'defines #hash' do
|
64
|
-
film = CineworldUk::Film.new 'AAAA'
|
65
|
-
film.methods.must_include :hash
|
66
|
-
end
|
67
|
-
|
68
|
-
describe '#hash' do
|
69
|
-
it 'returns a hash of the slug' do
|
70
|
-
film = CineworldUk::Film.new 'AAAA'
|
71
|
-
film.hash == film.slug.hash
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'defines #eql?(other)' do
|
76
|
-
film = CineworldUk::Film.new 'AAAA'
|
77
|
-
film.methods.must_include :eql?
|
78
|
-
end
|
79
|
-
|
80
|
-
describe 'two identically named films' do
|
81
|
-
let(:film) { CineworldUk::Film.new 'AAAA' }
|
82
|
-
let(:otherfilm) { CineworldUk::Film.new 'AAAA' }
|
83
|
-
|
84
|
-
it 'retuns only one' do
|
85
|
-
result = [film, otherfilm].uniq
|
86
|
-
result.count.must_equal 1
|
87
|
-
result.must_equal [CineworldUk::Film.new('AAAA')]
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
describe '<=> (other)' do
|
93
|
-
subject { film <=> otherfilm }
|
94
|
-
|
95
|
-
describe 'film less than other' do
|
96
|
-
let(:film) { CineworldUk::Film.new 'AAAA' }
|
97
|
-
let(:otherfilm) { CineworldUk::Film.new 'BBBB' }
|
98
|
-
|
99
|
-
it 'retuns -1' do
|
100
|
-
subject.must_equal(-1)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
describe 'film greater than other' do
|
105
|
-
let(:film) { CineworldUk::Film.new 'CCCC' }
|
106
|
-
let(:otherfilm) { CineworldUk::Film.new 'BBBB' }
|
107
|
-
|
108
|
-
it 'retuns 1' do
|
109
|
-
subject.must_equal 1
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
describe 'film same as other (exact name)' do
|
114
|
-
let(:film) { CineworldUk::Film.new 'AAAA' }
|
115
|
-
let(:otherfilm) { CineworldUk::Film.new 'AAAA' }
|
116
|
-
|
117
|
-
it 'retuns 0' do
|
118
|
-
subject.must_equal 0
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
describe 'film same as other (inexact name)' do
|
123
|
-
let(:film) { CineworldUk::Film.new 'blue jasmine' }
|
124
|
-
let(:otherfilm) { CineworldUk::Film.new 'Blue Jasmine' }
|
125
|
-
|
126
|
-
it 'retuns 0' do
|
127
|
-
subject.must_equal 0
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
private
|
134
|
-
|
135
|
-
def read_file(filepath)
|
136
|
-
File.read(File.expand_path(filepath, __FILE__))
|
137
|
-
end
|
138
|
-
|
139
|
-
def whatson_html(filename)
|
140
|
-
read_file("../../../fixtures/whatson/#{filename}.html")
|
141
|
-
end
|
142
|
-
end
|
@@ -1,101 +0,0 @@
|
|
1
|
-
require_relative '../../../test_helper'
|
2
|
-
|
3
|
-
describe CineworldUk::Internal::FilmWithScreeningsParser do
|
4
|
-
let(:described_class) { CineworldUk::Internal::FilmWithScreeningsParser }
|
5
|
-
|
6
|
-
describe '#film_name' do
|
7
|
-
subject { described_class.new(film_html).film_name }
|
8
|
-
|
9
|
-
describe 'passed film html from top of page' do
|
10
|
-
let(:film_html) { read_film_html('brighton/film_first') }
|
11
|
-
|
12
|
-
it 'returns the film name' do
|
13
|
-
subject.must_be_instance_of(String)
|
14
|
-
subject.must_equal('The Boxtrolls')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe 'passed film html from page' do
|
19
|
-
let(:film_html) { read_film_html('brighton/film_second') }
|
20
|
-
|
21
|
-
it 'returns the film name' do
|
22
|
-
subject.must_be_instance_of(String)
|
23
|
-
subject.must_equal('Sex Tape')
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'passed film html from end of page' do
|
28
|
-
let(:film_html) { read_film_html('brighton/film_last') }
|
29
|
-
|
30
|
-
it 'returns the film name' do
|
31
|
-
subject.must_be_instance_of(String)
|
32
|
-
subject.must_equal('The Vatican Museums')
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe '#to_a' do
|
38
|
-
subject { described_class.new(film_html).to_a }
|
39
|
-
|
40
|
-
describe 'passed film html from top of page' do
|
41
|
-
let(:film_html) { read_film_html('brighton/film_first') }
|
42
|
-
let(:permitted_types) { %w(baby hfr kids) }
|
43
|
-
|
44
|
-
it 'returns a non-zero array of hashes' do
|
45
|
-
subject.must_be_instance_of(Array)
|
46
|
-
subject.size.must_be :>=, 1
|
47
|
-
subject.each do |hash|
|
48
|
-
hash.must_be_instance_of(Hash)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'contains properly completed hashes' do
|
53
|
-
subject.each do |hash|
|
54
|
-
hash[:booking_url].must_include('http://www.cineworld.co.uk')
|
55
|
-
hash[:dimension].must_match(/\A[23]d\z/)
|
56
|
-
hash[:time].must_be_instance_of(Time)
|
57
|
-
hash[:variant].must_be_instance_of(Array)
|
58
|
-
hash[:variant].each do |type|
|
59
|
-
type.must_be_instance_of(String)
|
60
|
-
permitted_types.must_include(type)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe 'passed film html from top of dbox cinema page' do
|
67
|
-
let(:film_html) { read_film_html('the-o2-greenwich/film_first') }
|
68
|
-
let(:permitted_types) { %w(baby dbox hfr kids) }
|
69
|
-
|
70
|
-
it 'returns a hash with allowed variants' do
|
71
|
-
subject.each do |hash|
|
72
|
-
hash[:variant].each do |type|
|
73
|
-
type.must_be_instance_of(String)
|
74
|
-
permitted_types.must_include(type)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe 'passed film html from top of imax cinema page' do
|
81
|
-
let(:film_html) { read_film_html('glasgow-imax-at-gsc/film_first') }
|
82
|
-
let(:permitted_types) { %w(baby dbox hfr imax kids) }
|
83
|
-
|
84
|
-
it 'returns a hash with allowed variants' do
|
85
|
-
subject.each do |hash|
|
86
|
-
hash[:variant].each do |type|
|
87
|
-
type.must_be_instance_of(String)
|
88
|
-
permitted_types.must_include(type)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
private
|
96
|
-
|
97
|
-
def read_film_html(filename)
|
98
|
-
path = '../../../../fixtures/whatson/'
|
99
|
-
File.read(File.expand_path(path + "#{filename}.html", __FILE__))
|
100
|
-
end
|
101
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require_relative '../../../test_helper'
|
2
|
-
|
3
|
-
describe CineworldUk::Internal::Website do
|
4
|
-
describe '#cinemas' do
|
5
|
-
subject { CineworldUk::Internal::Website.new.cinemas }
|
6
|
-
|
7
|
-
before { stub_get('cinemas', cinemas_html) }
|
8
|
-
|
9
|
-
it 'returns a string' do
|
10
|
-
subject.class.must_equal String
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '#cinema_information(id)' do
|
15
|
-
subject { CineworldUk::Internal::Website.new.cinema_information(3) }
|
16
|
-
|
17
|
-
before { stub_get('cinemas/3/information', information_html) }
|
18
|
-
|
19
|
-
it 'returns a string' do
|
20
|
-
subject.class.must_equal String
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#whatson(id)' do
|
25
|
-
subject { CineworldUk::Internal::Website.new.whatson(3) }
|
26
|
-
|
27
|
-
before { stub_get('whatson?cinema=3', whatson_html) }
|
28
|
-
|
29
|
-
it 'returns a string' do
|
30
|
-
subject.class.must_equal String
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def read_file(filepath)
|
37
|
-
File.read(File.expand_path(filepath, __FILE__))
|
38
|
-
end
|
39
|
-
|
40
|
-
def cinemas_html
|
41
|
-
read_file('../../../../fixtures/cinemas.html')
|
42
|
-
end
|
43
|
-
|
44
|
-
def information_html
|
45
|
-
read_file('../../../../fixtures/information/brighton.html')
|
46
|
-
end
|
47
|
-
|
48
|
-
def stub_get(site_path, response_body)
|
49
|
-
url = "http://www.cineworld.co.uk/#{site_path}"
|
50
|
-
response = { status: 200, body: response_body, headers: {} }
|
51
|
-
stub_request(:get, url).to_return(response)
|
52
|
-
end
|
53
|
-
|
54
|
-
def whatson_html
|
55
|
-
read_file('../../../../fixtures/whatson/brighton.html')
|
56
|
-
end
|
57
|
-
end
|