picturehouse_uk 4.0.0 → 5.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.
Files changed (53) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +26 -0
  3. data/.github/workflows/release.yml +26 -0
  4. data/.gitignore +1 -0
  5. data/.ruby-version +1 -0
  6. data/CHANGELOG.md +25 -0
  7. data/Rakefile +2 -2
  8. data/lib/picturehouse_uk/cinema.rb +30 -14
  9. data/lib/picturehouse_uk/internal/api.rb +42 -0
  10. data/lib/picturehouse_uk/internal/parser/address.rb +21 -6
  11. data/lib/picturehouse_uk/internal/parser/screenings.rb +85 -133
  12. data/lib/picturehouse_uk/internal/website.rb +10 -12
  13. data/lib/picturehouse_uk/version.rb +2 -2
  14. data/lib/picturehouse_uk.rb +1 -0
  15. data/picturehouse_uk.gemspec +2 -3
  16. data/rake/fixture_creator.rb +21 -1
  17. data/test/fixtures/cinemas.html +4262 -0
  18. data/test/fixtures/duke-of-york-s-picturehouse/cinema.html +6187 -0
  19. data/test/fixtures/duke-of-york-s-picturehouse/get_movies.json +120552 -0
  20. data/test/fixtures/duke-of-york-s-picturehouse/information.html +3725 -0
  21. data/test/fixtures/duke-s-at-komedia/cinema.html +6138 -0
  22. data/test/fixtures/duke-s-at-komedia/get_movies.json +112 -0
  23. data/test/fixtures/duke-s-at-komedia/information.html +3690 -0
  24. data/test/fixtures/home.html +6235 -555
  25. data/test/fixtures/phoenix-picturehouse/cinema.html +6089 -0
  26. data/test/fixtures/phoenix-picturehouse/get_movies.json +120552 -0
  27. data/test/fixtures/phoenix-picturehouse/information.html +3630 -0
  28. data/test/lib/picturehouse_uk/cinema_test.rb +34 -34
  29. data/test/lib/picturehouse_uk/internal/api_test.rb +92 -0
  30. data/test/lib/picturehouse_uk/internal/parser/address_test.rb +8 -8
  31. data/test/lib/picturehouse_uk/internal/parser/screenings_test.rb +99 -45
  32. data/test/lib/picturehouse_uk/internal/title_sanitizer_test.rb +48 -48
  33. data/test/lib/picturehouse_uk/internal/website_test.rb +12 -31
  34. data/test/lib/picturehouse_uk/performance_test.rb +63 -23
  35. data/test/lib/picturehouse_uk/version_test.rb +1 -1
  36. data/test/live/integration_test.rb +8 -8
  37. data/test/support/fake_api.rb +16 -0
  38. data/test/support/fake_website.rb +6 -6
  39. data/test/test_helper.rb +3 -2
  40. metadata +34 -50
  41. data/.travis.yml +0 -8
  42. data/test/fixtures/Duke_Of_Yorks/cinema.html +0 -3408
  43. data/test/fixtures/Duke_Of_Yorks/info.html +0 -556
  44. data/test/fixtures/Duke_Of_Yorks/whats_on.html +0 -3159
  45. data/test/fixtures/Dukes_At_Komedia/cinema.html +0 -4764
  46. data/test/fixtures/Dukes_At_Komedia/info.html +0 -526
  47. data/test/fixtures/Dukes_At_Komedia/whats_on.html +0 -4429
  48. data/test/fixtures/National_Media_Museum/cinema.html +0 -9200
  49. data/test/fixtures/National_Media_Museum/info.html +0 -606
  50. data/test/fixtures/National_Media_Museum/whats_on.html +0 -8850
  51. data/test/fixtures/Phoenix_Picturehouse/cinema.html +0 -8274
  52. data/test/fixtures/Phoenix_Picturehouse/info.html +0 -542
  53. data/test/fixtures/Phoenix_Picturehouse/whats_on.html +0 -7986
@@ -10,7 +10,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
10
10
  let(:title) { 'Withnail & I' }
11
11
 
12
12
  it 'removes dimension' do
13
- subject.must_equal('Withnail & I')
13
+ _(subject).must_equal('Withnail & I')
14
14
  end
15
15
  end
16
16
 
@@ -18,7 +18,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
18
18
  let(:title) { 'Iron Man 3 2D' }
19
19
 
20
20
  it 'removes dimension' do
21
- subject.must_equal('Iron Man 3')
21
+ _(subject).must_equal('Iron Man 3')
22
22
  end
23
23
  end
24
24
 
@@ -26,7 +26,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
26
26
  let(:title) { 'ParaNorman (2D)' }
27
27
 
28
28
  it 'removes dimension' do
29
- subject.must_equal('ParaNorman')
29
+ _(subject).must_equal('ParaNorman')
30
30
  end
31
31
  end
32
32
 
@@ -34,7 +34,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
34
34
  let(:title) { 'Miracle on 34th Street (1947)' }
35
35
 
36
36
  it 'removes year' do
37
- subject.must_equal('Miracle on 34th Street')
37
+ _(subject).must_equal('Miracle on 34th Street')
38
38
  end
39
39
  end
40
40
 
@@ -42,7 +42,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
42
42
  let(:title) { 'Iron Man 3 3d' }
43
43
 
44
44
  it 'removes dimension' do
45
- subject.must_equal('Iron Man 3')
45
+ _(subject).must_equal('Iron Man 3')
46
46
  end
47
47
  end
48
48
 
@@ -50,7 +50,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
50
50
  let(:title) { 'Tarzan - Autism-Friendly Screening' }
51
51
 
52
52
  it 'removes screening type' do
53
- subject.must_equal('Tarzan')
53
+ _(subject).must_equal('Tarzan')
54
54
  end
55
55
  end
56
56
 
@@ -58,7 +58,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
58
58
  let(:title) { 'Iron Man 3 [NO CERT]' }
59
59
 
60
60
  it 'removes dimension' do
61
- subject.must_equal('Iron Man 3')
61
+ _(subject).must_equal('Iron Man 3')
62
62
  end
63
63
  end
64
64
 
@@ -66,7 +66,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
66
66
  let(:title) { 'Iron Man 3 []' }
67
67
 
68
68
  it 'removes dimension' do
69
- subject.must_equal('Iron Man 3')
69
+ _(subject).must_equal('Iron Man 3')
70
70
  end
71
71
  end
72
72
 
@@ -74,7 +74,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
74
74
  let(:title) { 'Beauty and the Beast 2D [U]' }
75
75
 
76
76
  it 'removes dimension' do
77
- subject.must_equal('Beauty and the Beast')
77
+ _(subject).must_equal('Beauty and the Beast')
78
78
  end
79
79
  end
80
80
 
@@ -82,7 +82,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
82
82
  let(:title) { 'KIDS CLUB Escape from Planet Earth' }
83
83
 
84
84
  it 'removes KIDS CLUB' do
85
- subject.must_equal('Escape from Planet Earth')
85
+ _(subject).must_equal('Escape from Planet Earth')
86
86
  end
87
87
  end
88
88
 
@@ -90,7 +90,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
90
90
  let(:title) { 'DISCOVER TUE All this Mayhem' }
91
91
 
92
92
  it 'remove rogue screening type' do
93
- subject.must_equal('All this Mayhem')
93
+ _(subject).must_equal('All this Mayhem')
94
94
  end
95
95
  end
96
96
 
@@ -98,7 +98,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
98
98
  let(:title) { 'Discover Tuesday: Manakamana [U]' }
99
99
 
100
100
  it 'remove rogue screening type' do
101
- subject.must_equal('Manakamana')
101
+ _(subject).must_equal('Manakamana')
102
102
  end
103
103
  end
104
104
 
@@ -106,7 +106,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
106
106
  let(:title) { 'Frozen Singalong [PG]' }
107
107
 
108
108
  it 'remove rogue screening type' do
109
- subject.must_equal('Frozen')
109
+ _(subject).must_equal('Frozen')
110
110
  end
111
111
  end
112
112
 
@@ -114,7 +114,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
114
114
  let(:title) { 'FREE Screening - Withnail & I' }
115
115
 
116
116
  it 'remove rogue screening type' do
117
- subject.must_equal('Withnail & I')
117
+ _(subject).must_equal('Withnail & I')
118
118
  end
119
119
  end
120
120
 
@@ -122,7 +122,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
122
122
  let(:title) { 'Beauty and the Beast 2D (Re) [U]' }
123
123
 
124
124
  it 'removes dimension' do
125
- subject.must_equal('Beauty and the Beast')
125
+ _(subject).must_equal('Beauty and the Beast')
126
126
  end
127
127
  end
128
128
 
@@ -130,7 +130,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
130
130
  let(:title) { 'Hidden Colors 3: The Rules of Racism + Q&A' }
131
131
 
132
132
  it 'removes suffix' do
133
- subject.must_equal('Hidden Colors 3: The Rules of Racism')
133
+ _(subject).must_equal('Hidden Colors 3: The Rules of Racism')
134
134
  end
135
135
  end
136
136
 
@@ -138,7 +138,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
138
138
  let(:title) { 'Luna Plus Q&A with Director and Artist Dave McKean' }
139
139
 
140
140
  it 'removes suffix' do
141
- subject.must_equal('Luna')
141
+ _(subject).must_equal('Luna')
142
142
  end
143
143
  end
144
144
 
@@ -146,7 +146,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
146
146
  let(:title) { 'A Dangerous Game + Panel Discussion' }
147
147
 
148
148
  it 'removes suffix' do
149
- subject.must_equal('A Dangerous Game')
149
+ _(subject).must_equal('A Dangerous Game')
150
150
  end
151
151
  end
152
152
 
@@ -154,7 +154,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
154
154
  let(:title) { 'Cinemania: The Imposter' }
155
155
 
156
156
  it 'removes prefix' do
157
- subject.must_equal('The Imposter')
157
+ _(subject).must_equal('The Imposter')
158
158
  end
159
159
  end
160
160
 
@@ -162,7 +162,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
162
162
  let(:title) { 'Gone Girl @ Komedia [18]' }
163
163
 
164
164
  it 'removes suffix' do
165
- subject.must_equal('Gone Girl')
165
+ _(subject).must_equal('Gone Girl')
166
166
  end
167
167
  end
168
168
 
@@ -170,7 +170,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
170
170
  let(:title) { 'Paddington@Komedia' }
171
171
 
172
172
  it 'removes suffix' do
173
- subject.must_equal('Paddington')
173
+ _(subject).must_equal('Paddington')
174
174
  end
175
175
  end
176
176
 
@@ -178,7 +178,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
178
178
  let(:title) { 'Dinosaurs Alive! IMAX' }
179
179
 
180
180
  it 'removes suffix' do
181
- subject.must_equal('Dinosaurs Alive!')
181
+ _(subject).must_equal('Dinosaurs Alive!')
182
182
  end
183
183
  end
184
184
 
@@ -186,7 +186,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
186
186
  let(:title) { 'Metropolis (Re-issue)' }
187
187
 
188
188
  it 'removes suffix' do
189
- subject.must_equal('Metropolis')
189
+ _(subject).must_equal('Metropolis')
190
190
  end
191
191
  end
192
192
 
@@ -194,7 +194,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
194
194
  let(:title) { "'71 *HOH Subtitled*" }
195
195
 
196
196
  it 'removes extra info' do
197
- subject.must_equal("'71")
197
+ _(subject).must_equal("'71")
198
198
  end
199
199
  end
200
200
 
@@ -202,7 +202,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
202
202
  let(:title) { 'Big Scream - Effie Gray' }
203
203
 
204
204
  it 'removes extra info' do
205
- subject.must_equal('Effie Gray')
205
+ _(subject).must_equal('Effie Gray')
206
206
  end
207
207
  end
208
208
 
@@ -210,7 +210,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
210
210
  let(:title) { "ParaNorman (2D) - Kids' Club" }
211
211
 
212
212
  it 'removes extra info' do
213
- subject.must_equal('ParaNorman')
213
+ _(subject).must_equal('ParaNorman')
214
214
  end
215
215
  end
216
216
 
@@ -218,7 +218,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
218
218
  let(:title) { "Rosemary's Baby - Reminiscence" }
219
219
 
220
220
  it 'removes extra info' do
221
- subject.must_equal("Rosemary's Baby")
221
+ _(subject).must_equal("Rosemary's Baby")
222
222
  end
223
223
  end
224
224
 
@@ -226,7 +226,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
226
226
  let(:title) { 'Bolshoi: Spartacus [NO CERT]' }
227
227
 
228
228
  it 'removes prefix' do
229
- subject.must_equal('Bolshoi: Spartacus')
229
+ _(subject).must_equal('Bolshoi: Spartacus')
230
230
  end
231
231
  end
232
232
 
@@ -234,7 +234,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
234
234
  let(:title) { 'Bolshoi: La Bayadere (Captured Live in 2012)' }
235
235
 
236
236
  it 'removes suffix' do
237
- subject.must_equal('Bolshoi: La Bayadere')
237
+ _(subject).must_equal('Bolshoi: La Bayadere')
238
238
  end
239
239
  end
240
240
 
@@ -244,7 +244,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
244
244
  end
245
245
 
246
246
  it 'removes certificate TBC' do
247
- subject.must_equal 'Glyndebourne Tour 2014: The Cunning Little Vixen'
247
+ _(subject).must_equal 'Glyndebourne Tour 2014: The Cunning Little Vixen'
248
248
  end
249
249
  end
250
250
 
@@ -252,7 +252,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
252
252
  let(:title) { 'Met. Opera: Macbeth [NO CERT]' }
253
253
 
254
254
  it 'removes prefix' do
255
- subject.must_equal('Met Opera: Macbeth')
255
+ _(subject).must_equal('Met Opera: Macbeth')
256
256
  end
257
257
  end
258
258
 
@@ -260,7 +260,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
260
260
  let(:title) { 'Met Opera: Rusalka [AS LIVE: 12A]' }
261
261
 
262
262
  it 'removes prefix' do
263
- subject.must_equal('Met Opera: Rusalka')
263
+ _(subject).must_equal('Met Opera: Rusalka')
264
264
  end
265
265
  end
266
266
 
@@ -268,7 +268,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
268
268
  let(:title) { 'Met Opera:Le Nozze di Figaro [AS LIVE:12A]' }
269
269
 
270
270
  it 'removes prefix' do
271
- subject.must_equal('Met Opera: Le Nozze di Figaro')
271
+ _(subject).must_equal('Met Opera: Le Nozze di Figaro')
272
272
  end
273
273
  end
274
274
 
@@ -276,7 +276,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
276
276
  let(:title) { 'National Theatre: Hamlet [PG]' }
277
277
 
278
278
  it 'removes prefix' do
279
- subject.must_equal('NT Live: Hamlet')
279
+ _(subject).must_equal('NT Live: Hamlet')
280
280
  end
281
281
  end
282
282
 
@@ -284,7 +284,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
284
284
  let(:title) { 'ourscreen: Northern Soul [15]' }
285
285
 
286
286
  it 'removes prefix' do
287
- subject.must_equal('Northern Soul')
287
+ _(subject).must_equal('Northern Soul')
288
288
  end
289
289
  end
290
290
 
@@ -292,7 +292,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
292
292
  let(:title) { 'To Kill A Mockingbird (Re) [PG]' }
293
293
 
294
294
  it 'removes rerelease notice' do
295
- subject.must_equal('To Kill A Mockingbird')
295
+ _(subject).must_equal('To Kill A Mockingbird')
296
296
  end
297
297
  end
298
298
 
@@ -300,7 +300,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
300
300
  let(:title) { 'Withnail & I (re: 2014) [15]' }
301
301
 
302
302
  it 'removes rerelease notice' do
303
- subject.must_equal('Withnail & I')
303
+ _(subject).must_equal('Withnail & I')
304
304
  end
305
305
  end
306
306
 
@@ -308,7 +308,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
308
308
  let(:title) { 'TODDLER TIME: Timmy Time Programme 15' }
309
309
 
310
310
  it 'removes rerelease notice' do
311
- subject.must_equal('Timmy Time Programme 15')
311
+ _(subject).must_equal('Timmy Time Programme 15')
312
312
  end
313
313
  end
314
314
 
@@ -316,7 +316,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
316
316
  let(:title) { 'Royal Shakespeare Company: Richard II [NO CERT]' }
317
317
 
318
318
  it 'removes prefix' do
319
- subject.must_equal('Royal Shakespeare Company: Richard II')
319
+ _(subject).must_equal('Royal Shakespeare Company: Richard II')
320
320
  end
321
321
  end
322
322
 
@@ -324,7 +324,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
324
324
  let(:title) { 'ROH Encore: Swan Lake' }
325
325
 
326
326
  it 'removes prefix' do
327
- subject.must_equal('Royal Opera House: Swan Lake')
327
+ _(subject).must_equal('Royal Opera House: Swan Lake')
328
328
  end
329
329
  end
330
330
 
@@ -332,7 +332,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
332
332
  let(:title) { 'Paddington - Parents & Babies' }
333
333
 
334
334
  it 'removes suffix' do
335
- subject.must_equal('Paddington')
335
+ _(subject).must_equal('Paddington')
336
336
  end
337
337
  end
338
338
 
@@ -340,7 +340,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
340
340
  let(:title) { 'Subtitled: The Hobbit: The Battle of the Five Armies' }
341
341
 
342
342
  it 'removes prefix' do
343
- subject.must_equal('The Hobbit: The Battle of the Five Armies')
343
+ _(subject).must_equal('The Hobbit: The Battle of the Five Armies')
344
344
  end
345
345
  end
346
346
 
@@ -348,7 +348,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
348
348
  let(:title) { 'English National Opera: Carmen (Live)' }
349
349
 
350
350
  it 'removes live suffix' do
351
- subject.must_equal('English National Opera: Carmen')
351
+ _(subject).must_equal('English National Opera: Carmen')
352
352
  end
353
353
  end
354
354
 
@@ -356,7 +356,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
356
356
  let(:title) { 'The Living Room with Gavin Clark [TBC]' }
357
357
 
358
358
  it 'removes tbc cert' do
359
- subject.must_equal('The Living Room with Gavin Clark')
359
+ _(subject).must_equal('The Living Room with Gavin Clark')
360
360
  end
361
361
  end
362
362
 
@@ -364,7 +364,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
364
364
  let(:title) { 'Woman In Gold [N/A]' }
365
365
 
366
366
  it 'removes tbc cert' do
367
- subject.must_equal('Woman In Gold')
367
+ _(subject).must_equal('Woman In Gold')
368
368
  end
369
369
  end
370
370
 
@@ -372,7 +372,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
372
372
  let(:title) { 'Maxine Peake As Hamlet (Theatre)' }
373
373
 
374
374
  it 'removes tbc cert' do
375
- subject.must_equal('Maxine Peake As Hamlet')
375
+ _(subject).must_equal('Maxine Peake As Hamlet')
376
376
  end
377
377
  end
378
378
 
@@ -380,7 +380,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
380
380
  let(:title) { "Dr Sketchy's Anti-Art School [R18]" }
381
381
 
382
382
  it 'removes tbc cert' do
383
- subject.must_equal("Dr Sketchy's Anti-Art School")
383
+ _(subject).must_equal("Dr Sketchy's Anti-Art School")
384
384
  end
385
385
  end
386
386
 
@@ -388,7 +388,7 @@ describe PicturehouseUk::Internal::TitleSanitizer do
388
388
  let(:title) { 'Spartacus (Bolshoi Ballet)' }
389
389
 
390
390
  it 'reorders the title' do
391
- subject.must_equal('Bolshoi Ballet: Spartacus')
391
+ _(subject).must_equal('Bolshoi Ballet: Spartacus')
392
392
  end
393
393
  end
394
394
  end
@@ -7,12 +7,12 @@ describe PicturehouseUk::Internal::Website do
7
7
  after { WebMock.allow_net_connect! }
8
8
 
9
9
  describe '#cinema(id)' do
10
- subject { described_class.new.cinema('Duke_Of_Yorks') }
10
+ subject { described_class.new.cinema('duke-of-york-s-picturehouse') }
11
11
 
12
- before { stub_get('cinema/Duke_Of_Yorks', duke_of_yorks_html) }
12
+ before { stub_get('cinema/duke-of-york-s-picturehouse', duke_of_yorks_html) }
13
13
 
14
14
  it 'returns a string' do
15
- subject.class.must_equal String
15
+ _(subject.class).must_equal String
16
16
  end
17
17
  end
18
18
 
@@ -22,52 +22,33 @@ describe PicturehouseUk::Internal::Website do
22
22
  before { stub_get('', home_html) }
23
23
 
24
24
  it 'returns a string' do
25
- subject.class.must_equal String
25
+ _(subject.class).must_equal String
26
26
  end
27
27
  end
28
28
 
29
- describe '#info(id)' do
30
- subject { described_class.new.info('Duke_Of_Yorks') }
29
+ describe '#information(id)' do
30
+ subject { described_class.new.information('duke-of-york-s-picturehouse') }
31
31
 
32
32
  before do
33
33
  stub_get(
34
- 'cinema/info/Duke_Of_Yorks',
35
- duke_of_yorks_contact_us_html
34
+ 'cinema/duke-of-york-s-picturehouse/information',
35
+ duke_of_yorks_information_html
36
36
  )
37
37
  end
38
38
 
39
39
  it 'returns a string' do
40
- subject.class.must_equal String
41
- end
42
- end
43
-
44
- describe '#whats_on(id)' do
45
- subject { described_class.new.whats_on('Duke_Of_Yorks') }
46
-
47
- before do
48
- stub_get(
49
- 'cinema/Duke_Of_Yorks/Whats_On',
50
- duke_of_yorks_whats_on_html
51
- )
52
- end
53
-
54
- it 'returns a string' do
55
- subject.class.must_equal String
40
+ _(subject.class).must_equal String
56
41
  end
57
42
  end
58
43
 
59
44
  private
60
45
 
61
46
  def duke_of_yorks_html
62
- read_file('../../../../fixtures/Duke_Of_Yorks/cinema.html')
63
- end
64
-
65
- def duke_of_yorks_contact_us_html
66
- read_file('../../../../fixtures/Duke_Of_Yorks/info.html')
47
+ read_file('../../../../fixtures/duke-of-york-s-picturehouse/cinema.html')
67
48
  end
68
49
 
69
- def duke_of_yorks_whats_on_html
70
- read_file('../../../../fixtures/Duke_Of_Yorks/whats_on.html')
50
+ def duke_of_yorks_information_html
51
+ read_file('../../../../fixtures/duke-of-york-s-picturehouse/information.html')
71
52
  end
72
53
 
73
54
  def home_html
@@ -8,27 +8,67 @@ describe PicturehouseUk::Performance do
8
8
  after { WebMock.allow_net_connect! }
9
9
 
10
10
  describe '.at(cinema_id)' do
11
- subject { described_class.at('Duke_Of_Yorks') }
11
+ let(:api_client) { FakeApi.new }
12
+ subject { described_class.at('duke-s-at-komedia') }
12
13
 
13
14
  it 'returns an array of screenings' do
14
15
  PicturehouseUk::Internal::Website.stub :new, website do
15
- subject.must_be_instance_of(Array)
16
- subject.each do |screening|
17
- screening.must_be_instance_of(PicturehouseUk::Performance)
16
+ PicturehouseUk::Internal::Api.stub :new, api_client do
17
+ _(subject).must_be_instance_of(Array)
18
+ subject.each do |screening|
19
+ _(screening).must_be_instance_of(PicturehouseUk::Performance)
20
+ end
18
21
  end
19
22
  end
20
23
  end
21
24
 
22
25
  it 'returns correct number of screenings' do
23
26
  PicturehouseUk::Internal::Website.stub :new, website do
24
- subject.count.must_be :>, 40
27
+ PicturehouseUk::Internal::Api.stub :new, api_client do
28
+ _(subject.count).must_equal 8
29
+ end
25
30
  end
26
31
  end
27
32
 
28
33
  it 'has valid screenings' do
29
34
  PicturehouseUk::Internal::Website.stub :new, website do
30
- subject.map(&:starting_at).each do |time|
31
- time.wont_equal Time.utc(1970, 1, 1, 0, 0)
35
+ PicturehouseUk::Internal::Api.stub :new, api_client do
36
+ subject.map(&:starting_at).each do |time|
37
+ _(time).wont_equal Time.utc(1970, 1, 1, 0, 0)
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ it 'includes different variants' do
44
+ PicturehouseUk::Internal::Website.stub :new, website do
45
+ PicturehouseUk::Internal::Api.stub :new, api_client do
46
+ variants = subject.flat_map(&:variant).uniq
47
+ _(variants).must_include 'arts'
48
+ _(variants).must_include 'kids'
49
+ _(variants).must_include 'senior'
50
+ end
51
+ end
52
+ end
53
+
54
+ it 'correctly identifies 3D films' do
55
+ PicturehouseUk::Internal::Website.stub :new, website do
56
+ PicturehouseUk::Internal::Api.stub :new, api_client do
57
+ three_d_screenings = subject.select { |s| s.dimension == '3d' }
58
+ _(three_d_screenings).wont_be_empty
59
+ three_d_screenings.each do |screening|
60
+ _(screening.film_name).must_match(/Marvels/i)
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+ it 'generates booking URLs' do
67
+ PicturehouseUk::Internal::Website.stub :new, website do
68
+ PicturehouseUk::Internal::Api.stub :new, api_client do
69
+ subject.each do |screening|
70
+ _(screening.booking_url).must_match(%r{\Ahttps://web\.picturehouses\.com/order/showtimes/})
71
+ end
32
72
  end
33
73
  end
34
74
  end
@@ -48,14 +88,14 @@ describe PicturehouseUk::Performance do
48
88
  end
49
89
 
50
90
  it 'sets cinema name and film name' do
51
- subject.film_name.must_equal 'Iron Man 3'
52
- subject.cinema_name.must_equal 'Cineworld Brighton'
91
+ _(subject.film_name).must_equal 'Iron Man 3'
92
+ _(subject.cinema_name).must_equal 'Cineworld Brighton'
53
93
  end
54
94
 
55
95
  it 'booking url, dimension & varient are set to defaults' do
56
- subject.booking_url.must_equal nil
57
- subject.dimension.must_equal '2d'
58
- subject.variant.must_equal []
96
+ _(subject.booking_url).must_be_nil
97
+ _(subject.dimension).must_equal '2d'
98
+ _(subject.variant).must_equal []
59
99
  end
60
100
  end
61
101
  end
@@ -74,8 +114,8 @@ describe PicturehouseUk::Performance do
74
114
  subject { described_class.new(options).dimension }
75
115
 
76
116
  it 'returns 2d or 3d' do
77
- subject.must_be_instance_of(String)
78
- subject.must_equal '3d'
117
+ _(subject).must_be_instance_of(String)
118
+ _(subject).must_equal '3d'
79
119
  end
80
120
  end
81
121
 
@@ -93,8 +133,8 @@ describe PicturehouseUk::Performance do
93
133
  end
94
134
 
95
135
  it 'returns UTC time' do
96
- subject.must_be_instance_of Time
97
- subject.must_equal Time.utc(2013, 9, 12, 11, 0)
136
+ _(subject).must_be_instance_of Time
137
+ _(subject).must_equal Time.utc(2013, 9, 12, 11, 0)
98
138
  end
99
139
  end
100
140
 
@@ -109,8 +149,8 @@ describe PicturehouseUk::Performance do
109
149
  end
110
150
 
111
151
  it 'returns UTC time' do
112
- subject.must_be_instance_of Time
113
- subject.must_equal Time.utc(2013, 9, 12, 10, 0)
152
+ _(subject).must_be_instance_of Time
153
+ _(subject).must_equal Time.utc(2013, 9, 12, 10, 0)
114
154
  end
115
155
  end
116
156
  end
@@ -128,8 +168,8 @@ describe PicturehouseUk::Performance do
128
168
  subject { described_class.new(options).showing_on }
129
169
 
130
170
  it 'returns date of showing' do
131
- subject.must_be_instance_of(Date)
132
- subject.must_equal Date.new(2013, 9, 12)
171
+ _(subject).must_be_instance_of(Date)
172
+ _(subject).must_equal Date.new(2013, 9, 12)
133
173
  end
134
174
  end
135
175
 
@@ -147,11 +187,11 @@ describe PicturehouseUk::Performance do
147
187
  end
148
188
 
149
189
  it 'is an alphabetically ordered array of lower-cased strings' do
150
- subject.must_be_instance_of Array
190
+ _(subject).must_be_instance_of Array
151
191
  subject.each do |tag|
152
- tag.must_be_instance_of String
192
+ _(tag).must_be_instance_of String
153
193
  end
154
- subject.must_equal %w(kids)
194
+ _(subject).must_equal %w(kids)
155
195
  end
156
196
  end
157
197
  end
@@ -2,6 +2,6 @@ require_relative '../../test_helper'
2
2
 
3
3
  describe PicturehouseUk do
4
4
  it 'must be defined' do
5
- PicturehouseUk::VERSION.wont_be_nil
5
+ _(PicturehouseUk::VERSION).wont_be_nil
6
6
  end
7
7
  end