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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -3
  3. data/README.md +56 -14
  4. data/Rakefile +57 -1
  5. data/cineworld_uk.gemspec +1 -2
  6. data/lib/cineworld_uk/cinema.rb +113 -182
  7. data/lib/cineworld_uk/internal/api_response.rb +74 -0
  8. data/lib/cineworld_uk/internal/parser/api/cinema_address.rb +81 -0
  9. data/lib/cineworld_uk/internal/parser/api/film.rb +46 -0
  10. data/lib/cineworld_uk/internal/parser/api/film_lookup.rb +38 -0
  11. data/lib/cineworld_uk/internal/parser/api/performance.rb +46 -0
  12. data/lib/cineworld_uk/internal/parser/api/performances_by_day.rb +50 -0
  13. data/lib/cineworld_uk/internal/title_sanitizer.rb +56 -52
  14. data/lib/cineworld_uk/performance.rb +78 -0
  15. data/lib/cineworld_uk/version.rb +2 -2
  16. data/lib/cineworld_uk.rb +11 -8
  17. data/test/fixtures/api/cinema-detail-10.json +1 -0
  18. data/test/fixtures/api/cinema-detail-21.json +1 -0
  19. data/test/fixtures/api/cinema-detail-3.json +1 -0
  20. data/test/fixtures/api/cinema-detail-96.json +1 -0
  21. data/test/fixtures/api/cinema-list.json +1 -0
  22. data/test/fixtures/api/dates-3.json +1 -0
  23. data/test/fixtures/api/film-list-comingsoon.json +1 -0
  24. data/test/fixtures/api/film-list.json +1 -0
  25. data/test/fixtures/api/performances-tomorrow-3.json +1 -0
  26. data/test/lib/cineworld_uk/cinema_test.rb +96 -197
  27. data/test/lib/cineworld_uk/internal/api_response_test.rb +85 -0
  28. data/test/lib/cineworld_uk/internal/parser/api/cinema_address_test.rb +93 -0
  29. data/test/lib/cineworld_uk/internal/parser/api/film_lookup_test.rb +30 -0
  30. data/test/lib/cineworld_uk/internal/parser/api/film_test.rb +169 -0
  31. data/test/lib/cineworld_uk/internal/parser/api/performance_test.rb +62 -0
  32. data/test/lib/cineworld_uk/internal/title_sanitizer_test.rb +1 -1
  33. data/test/lib/cineworld_uk/{screening_test.rb → performance_test.rb} +36 -48
  34. data/test/support/fixture_reader.rb +44 -0
  35. metadata +48 -59
  36. data/lib/cineworld_uk/film.rb +0 -65
  37. data/lib/cineworld_uk/internal/film_with_screenings_parser.rb +0 -69
  38. data/lib/cineworld_uk/internal/screening_parser.rb +0 -132
  39. data/lib/cineworld_uk/internal/website.rb +0 -35
  40. data/lib/cineworld_uk/internal/whatson_parser.rb +0 -36
  41. data/lib/cineworld_uk/screening.rb +0 -87
  42. data/test/fixture_updater.rb +0 -64
  43. data/test/fixtures/cinemas.html +0 -513
  44. data/test/fixtures/information/brighton.html +0 -1268
  45. data/test/fixtures/information/bristol.html +0 -1265
  46. data/test/fixtures/whatson/brighton/film_first.html +0 -207
  47. data/test/fixtures/whatson/brighton/film_last.html +0 -62
  48. data/test/fixtures/whatson/brighton/film_second.html +0 -347
  49. data/test/fixtures/whatson/brighton.html +0 -7508
  50. data/test/fixtures/whatson/glasgow-imax-at-gsc/film_first.html +0 -182
  51. data/test/fixtures/whatson/the-o2-greenwich/film_first.html +0 -167
  52. data/test/lib/cineworld_uk/film_test.rb +0 -142
  53. data/test/lib/cineworld_uk/internal/film_with_screenings_parser_test.rb +0 -101
  54. data/test/lib/cineworld_uk/internal/website_test.rb +0 -57
  55. data/test/lib/cineworld_uk/internal/whatson_parser_test.rb +0 -58
@@ -1,21 +1,21 @@
1
1
  require_relative '../../test_helper'
2
+ require_relative '../../support/fixture_reader'
2
3
 
3
4
  describe CineworldUk::Cinema do
4
- let(:website) { Minitest::Mock.new }
5
+ include Support::FixtureReader
5
6
 
6
- before do
7
- WebMock.disable_net_connect!
8
- end
7
+ let(:described_class) { CineworldUk::Cinema }
8
+ let(:api_response) { Minitest::Mock.new }
9
+
10
+ before { WebMock.disable_net_connect! }
9
11
 
10
12
  describe '.all' do
11
- subject { CineworldUk::Cinema.all }
13
+ subject { described_class.all }
12
14
 
13
- before do
14
- website.expect(:cinemas, cinemas_html)
15
- end
15
+ before { api_response.expect(:cinema_list, cinema_list_json) }
16
16
 
17
17
  it 'returns an Array of CineworldUK::Cinemas' do
18
- CineworldUk::Internal::Website.stub :new, website do
18
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
19
19
  subject.must_be_instance_of(Array)
20
20
  subject.each do |value|
21
21
  value.must_be_instance_of(CineworldUk::Cinema)
@@ -24,89 +24,30 @@ describe CineworldUk::Cinema do
24
24
  end
25
25
 
26
26
  it 'returns the correctly sized array' do
27
- CineworldUk::Internal::Website.stub :new, website do
28
- subject.size.must_equal 82
29
- end
30
- end
31
- end
32
-
33
- describe '.find(id)' do
34
- subject { CineworldUk::Cinema.find(id) }
35
-
36
- describe 'Brighton' do
37
- let(:id) { 3 }
38
-
39
- before do
40
- website.expect(:cinemas, cinemas_html)
41
- end
42
-
43
- it 'returns a cinema' do
44
- CineworldUk::Internal::Website.stub :new, website do
45
- subject.must_be_instance_of(CineworldUk::Cinema)
46
-
47
- subject.id.must_equal 3
48
- subject.brand.must_equal 'Cineworld'
49
- subject.name.must_equal 'Brighton'
50
- end
27
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
28
+ subject.size.must_equal(88)
51
29
  end
52
30
  end
53
31
  end
54
32
 
55
- describe '.new' do
56
- it 'removes "London - " name prefix' do
57
- cinema = CineworldUk::Cinema.new 79, 'London - The O2, Greenwich'
58
- cinema.id.must_equal 79
59
- cinema.name.must_equal 'The O2, Greenwich'
60
- cinema.slug.must_equal 'the-o2-greenwich'
61
- end
62
-
63
- it 'removes " - " and replaces it with a colon ": "' do
64
- cinema = CineworldUk::Cinema.new 88, 'Glasgow - IMAX at GSC'
65
- cinema.id.must_equal 88
66
- cinema.name.must_equal 'Glasgow: IMAX at GSC'
67
- cinema.slug.must_equal 'glasgow-imax-at-gsc'
68
- end
69
- end
70
-
71
33
  describe '#adr' do
72
- subject { cinema.adr }
34
+ subject { described_class.new(id).adr }
73
35
 
74
- describe '(brighton)' do
75
- let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
36
+ before do
37
+ api_response.expect(:cinema_detail, cinema_detail_json(id), [id])
38
+ end
76
39
 
77
- before do
78
- website.expect(:cinema_information, information_html('brighton'), [3])
79
- end
40
+ describe 'Brighton (3)' do
41
+ let(:id) { 3 }
80
42
 
81
43
  it 'returns the address hash' do
82
- CineworldUk::Internal::Website.stub :new, website do
44
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
83
45
  subject.must_equal(
84
- street_address: 'Brighton Marina',
46
+ street_address: 'Brighton Marina Village',
85
47
  extended_address: nil,
86
48
  locality: 'Brighton',
87
- region: 'East Sussex',
88
- postal_code: 'BN2 5UF',
89
- country: 'United Kingdom'
90
- )
91
- end
92
- end
93
- end
94
-
95
- describe '(bristol)' do
96
- let(:cinema) { CineworldUk::Cinema.new('4', 'Bristol') }
97
-
98
- before do
99
- website.expect(:cinema_information, information_html('bristol'), [4])
100
- end
101
-
102
- it 'returns the address hash' do
103
- CineworldUk::Internal::Website.stub :new, website do
104
- subject.must_equal(
105
- street_address: 'Hengrove Leisure Park',
106
- extended_address: 'Hengrove Way',
107
- locality: 'Bristol',
108
49
  region: nil,
109
- postal_code: 'BS14 0HR',
50
+ postal_code: 'BN2 5UF',
110
51
  country: 'United Kingdom'
111
52
  )
112
53
  end
@@ -115,111 +56,89 @@ describe CineworldUk::Cinema do
115
56
  end
116
57
 
117
58
  describe '#extended_address' do
118
- subject { cinema.extended_address }
119
-
120
- describe '(brighton)' do
121
- let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
122
-
123
- before do
124
- website.expect(:cinema_information, information_html('brighton'), [3])
125
- end
59
+ subject { described_class.new(id).extended_address }
126
60
 
127
- it 'returns nil' do
128
- CineworldUk::Internal::Website.stub :new, website do
129
- subject.must_be_nil
130
- end
131
- end
61
+ before do
62
+ api_response.expect(:cinema_detail, cinema_detail_json(id), [id])
132
63
  end
133
64
 
134
- describe '(bristol)' do
135
- let(:cinema) { CineworldUk::Cinema.new('4', 'Bristol') }
136
-
137
- before do
138
- website.expect(:cinema_information, information_html('bristol'), [4])
139
- end
65
+ describe 'Brighton (3)' do
66
+ let(:id) { 3 }
140
67
 
141
- it 'returns the second line' do
142
- CineworldUk::Internal::Website.stub :new, website do
143
- subject.must_equal 'Hengrove Way'
68
+ it 'returns the address hash' do
69
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
70
+ subject.must_equal('')
144
71
  end
145
72
  end
146
73
  end
147
74
  end
148
75
 
149
- describe '#films' do
150
- subject { CineworldUk::Cinema.new('3', 'Brighton').films }
151
-
152
- it 'calls out to Screening object' do
153
- CineworldUk::Film.stub :at, [:film] do
154
- subject.must_equal([:film])
155
- end
156
- end
157
- end
158
-
159
76
  describe '#full_name' do
160
- subject { cinema.full_name }
77
+ subject { described_class.new(id).full_name }
78
+
79
+ before { api_response.expect(:cinema_list, cinema_list_json) }
161
80
 
162
- describe 'simple name (brighton)' do
163
- let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
81
+ describe 'simple name (Brighton)' do
82
+ let(:id) { 3 }
164
83
 
165
84
  it 'returns the brand in the name' do
166
- subject.must_equal 'Cineworld Brighton'
85
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
86
+ subject.must_equal 'Cineworld Brighton'
87
+ end
167
88
  end
168
89
  end
169
90
 
170
- describe 'complex name (glasgow imax)' do
171
- let(:cinema) { CineworldUk::Cinema.new('88', 'Glasgow - IMAX at GSC') }
91
+ describe 'complex name (Glasgow IMAX)' do
92
+ let(:id) { 88 }
172
93
 
173
94
  it 'returns the brand in the name' do
174
- subject.must_equal 'Cineworld Glasgow: IMAX at GSC'
95
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
96
+ subject.must_equal 'Cineworld Glasgow: IMAX at GSC'
97
+ end
175
98
  end
176
99
  end
177
100
  end
178
101
 
179
102
  describe '#locality' do
180
- subject { cinema.locality }
103
+ subject { described_class.new(id).locality }
181
104
 
182
- describe '(brighton)' do
183
- let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
105
+ before do
106
+ api_response.expect(:cinema_detail, cinema_detail_json(id), [id])
107
+ end
184
108
 
185
- before do
186
- website.expect(:cinema_information, information_html('brighton'), [3])
187
- end
109
+ describe 'Brighton (3)' do
110
+ let(:id) { 3 }
188
111
 
189
112
  it 'returns the town/city' do
190
- CineworldUk::Internal::Website.stub :new, website do
113
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
191
114
  subject.must_equal 'Brighton'
192
115
  end
193
116
  end
194
117
  end
195
118
 
196
- describe '(bristol)' do
197
- let(:cinema) { CineworldUk::Cinema.new('4', 'Bristol') }
119
+ describe 'London - 10 (Chelsea)' do
120
+ let(:id) { 10 }
198
121
 
199
- before do
200
- website.expect(:cinema_information, information_html('bristol'), [4])
201
- end
202
-
203
- it 'returns the town/city' do
204
- CineworldUk::Internal::Website.stub :new, website do
205
- subject.must_equal 'Bristol'
122
+ it 'returns borough of London' do
123
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
124
+ subject.must_equal 'Chelsea'
206
125
  end
207
126
  end
208
127
  end
209
128
  end
210
129
 
211
130
  describe '#postal_code' do
212
- subject { cinema.postal_code }
131
+ subject { described_class.new(id).postal_code }
213
132
 
214
- describe '(brighton)' do
215
- let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
133
+ before do
134
+ api_response.expect(:cinema_detail, cinema_detail_json(id), [id])
135
+ end
216
136
 
217
- before do
218
- website.expect(:cinema_information, information_html('brighton'), [3])
219
- end
137
+ describe 'Brighton (3)' do
138
+ let(:id) { 3 }
220
139
 
221
140
  it 'returns the post code' do
222
- CineworldUk::Internal::Website.stub :new, website do
141
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
223
142
  subject.must_equal 'BN2 5UF'
224
143
  end
225
144
  end
@@ -227,88 +146,68 @@ describe CineworldUk::Cinema do
227
146
  end
228
147
 
229
148
  describe '#region' do
230
- subject { cinema.region }
231
-
232
- describe '(brighton)' do
233
- let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
234
-
235
- before do
236
- website.expect(:cinema_information, information_html('brighton'), [3])
237
- end
149
+ subject { described_class.new(id).region }
238
150
 
239
- it 'returns the county' do
240
- CineworldUk::Internal::Website.stub :new, website do
241
- subject.must_equal 'East Sussex'
242
- end
243
- end
151
+ before do
152
+ api_response.expect(:cinema_detail, cinema_detail_json(id), [id])
244
153
  end
245
154
 
246
- describe '(bristol)' do
247
- let(:cinema) { CineworldUk::Cinema.new('4', 'Bristol') }
248
-
249
- before do
250
- website.expect(:cinema_information, information_html('bristol'), [4])
251
- end
155
+ describe 'no region - Brighton (3)' do
156
+ let(:id) { 3 }
252
157
 
253
- it 'returns nil' do
254
- CineworldUk::Internal::Website.stub :new, website do
255
- subject.must_be_nil
158
+ it 'returns the empty string is none exists' do
159
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
160
+ subject.must_equal ''
256
161
  end
257
162
  end
258
163
  end
259
- end
260
164
 
261
- describe '#screenings' do
262
- subject { CineworldUk::Cinema.new('3', 'Brighton').screenings }
165
+ describe 'London - Chelsea (10)' do
166
+ let(:id) { 10 }
263
167
 
264
- it 'calls out to Screening object' do
265
- CineworldUk::Screening.stub :at, [:screening] do
266
- subject.must_equal([:screening])
168
+ it 'returns "London"' do
169
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
170
+ subject.must_equal 'London'
171
+ end
267
172
  end
268
173
  end
269
174
  end
270
175
 
271
176
  describe '#street_address' do
272
- subject { cinema.street_address }
177
+ subject { described_class.new(id).street_address }
273
178
 
274
- describe '(brighton)' do
275
- let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
179
+ before do
180
+ api_response.expect(:cinema_detail, cinema_detail_json(id), [id])
181
+ end
276
182
 
277
- before do
278
- website.expect(:cinema_information, information_html('brighton'), [3])
279
- end
183
+ describe 'Brighton (3)' do
184
+ let(:id) { 3 }
280
185
 
281
- it 'returns the street address' do
282
- CineworldUk::Internal::Website.stub :new, website do
283
- subject.must_equal 'Brighton Marina'
186
+ it 'returns the first line of the Address' do
187
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
188
+ subject.must_equal 'Brighton Marina Village'
284
189
  end
285
190
  end
286
191
  end
287
192
  end
288
193
 
289
194
  describe '#url' do
290
- subject { cinema.url }
291
-
292
- describe '(brighton)' do
293
- let(:cinema) { CineworldUk::Cinema.new('3', 'Brighton') }
195
+ subject { described_class.new(id).url }
294
196
 
295
- it 'returns the what on url' do
296
- subject.must_equal 'http://www.cineworld.co.uk/whatson?cinema=3'
297
- end
197
+ before do
198
+ api_response.expect(:cinema_detail, cinema_detail_json(id), [id])
298
199
  end
299
- end
300
-
301
- private
302
200
 
303
- def read_file(filepath)
304
- File.read(File.expand_path(filepath, __FILE__))
305
- end
306
-
307
- def cinemas_html
308
- read_file('../../../fixtures/cinemas.html')
309
- end
201
+ describe 'Brighton (3)' do
202
+ let(:id) { 3 }
310
203
 
311
- def information_html(filename)
312
- read_file("../../../fixtures/information/#{filename}.html")
204
+ it 'returns the url' do
205
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
206
+ subject.must_equal(
207
+ "http://www.cineworld.co.uk/cinemas/#{id}/information"
208
+ )
209
+ end
210
+ end
211
+ end
313
212
  end
314
213
  end
@@ -0,0 +1,85 @@
1
+ require_relative '../../../test_helper'
2
+ require_relative '../../../support/fixture_reader'
3
+
4
+ describe CineworldUk::Internal::ApiResponse do
5
+ include Support::FixtureReader
6
+
7
+ let(:described_class) { CineworldUk::Internal::ApiResponse }
8
+ let(:standard) { 'key=ios&territory=GB' }
9
+
10
+ describe '#cinema_list' do
11
+ subject { described_class.new.cinema_list }
12
+
13
+ before { stub_get("cinema/list?full=true&#{standard}", cinema_list_json) }
14
+
15
+ it 'returns a string' do
16
+ subject.class.must_equal String
17
+ end
18
+ end
19
+
20
+ describe '#cinema_detail(cinema_id, date)' do
21
+ subject { described_class.new.cinema_detail(3) }
22
+
23
+ before do
24
+ stub_get("cinema/detail?cinema=3&#{standard}", cinema_detail_json(3))
25
+ end
26
+
27
+ it 'returns a string' do
28
+ subject.class.must_equal String
29
+ end
30
+ end
31
+
32
+ describe '#dates(cinema_id)' do
33
+ subject { described_class.new.dates(3) }
34
+
35
+ before { stub_get("dates?cinema=3&#{standard}", dates_json(3)) }
36
+
37
+ it 'returns a string' do
38
+ subject.class.must_equal String
39
+ end
40
+ end
41
+
42
+ describe '#film_list' do
43
+ subject { described_class.new.film_list }
44
+
45
+ before { stub_get("film/list?full=true&#{standard}", film_list_json) }
46
+
47
+ it 'returns a string' do
48
+ subject.class.must_equal String
49
+ end
50
+ end
51
+
52
+ describe '#film_list_comingsoon' do
53
+ subject { described_class.new.film_list_comingsoon }
54
+
55
+ before do
56
+ stub_get("film/list/comingsoon?full=true&#{standard}",
57
+ film_list_comingsoon_json)
58
+ end
59
+
60
+ it 'returns a string' do
61
+ subject.class.must_equal String
62
+ end
63
+ end
64
+
65
+ describe '#performances(cinema_id, date)' do
66
+ subject { described_class.new.performances(3, Date.today + 1) }
67
+
68
+ before do
69
+ stub_get("performances?cinema=3&date=#{tomorrow_s}&#{standard}",
70
+ performances_tomorrow_json(3))
71
+ end
72
+
73
+ it 'returns a string' do
74
+ subject.class.must_equal String
75
+ end
76
+ end
77
+
78
+ private
79
+
80
+ def stub_get(site_path, response_body)
81
+ url = "http://www2.cineworld.co.uk/api/#{site_path}"
82
+ response = { status: 200, body: response_body, headers: {} }
83
+ stub_request(:get, url).to_return(response)
84
+ end
85
+ end
@@ -0,0 +1,93 @@
1
+ require_relative '../../../../../test_helper'
2
+ require_relative '../../../../../support/fixture_reader'
3
+
4
+ describe CineworldUk::Internal::Parser::Api::CinemaAddress do
5
+ include Support::FixtureReader
6
+
7
+ let(:described_class) { CineworldUk::Internal::Parser::Api::CinemaAddress }
8
+ let(:api_response) { Minitest::Mock.new }
9
+
10
+ before { WebMock.disable_net_connect! }
11
+
12
+ describe '#to_hash' do
13
+ subject { described_class.new(id).to_hash }
14
+
15
+ before do
16
+ api_response.expect(:cinema_detail, cinema_detail_json(id), [id])
17
+ end
18
+
19
+ describe 'passed simple (Brighton)' do
20
+ let(:id) { 3 }
21
+
22
+ it 'returns address hash' do
23
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
24
+ subject.must_equal(street_address: 'Brighton Marina Village',
25
+ extended_address: nil,
26
+ locality: 'Brighton',
27
+ region: nil,
28
+ postal_code: 'BN2 5UF',
29
+ country: 'United Kingdom')
30
+ end
31
+ end
32
+ end
33
+
34
+ describe 'passed three line (NEC)' do
35
+ let(:id) { 96 }
36
+
37
+ it 'returns address hash' do
38
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
39
+ subject.must_equal(street_address: 'Resorts World',
40
+ extended_address: 'Pendigo Way',
41
+ locality: 'Birmingham',
42
+ region: nil,
43
+ postal_code: 'B40 1PU',
44
+ country: 'United Kingdom')
45
+ end
46
+ end
47
+ end
48
+
49
+ describe 'passed three line (Edinburgh)' do
50
+ let(:id) { 21 }
51
+
52
+ it 'returns address hash' do
53
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
54
+ subject.must_equal(street_address: 'Fountain Park',
55
+ extended_address: '130/3 Dundee Street',
56
+ locality: 'Edinburgh',
57
+ region: nil,
58
+ postal_code: 'EH11 1AF',
59
+ country: 'United Kingdom')
60
+ end
61
+ end
62
+ end
63
+
64
+ describe 'passed three line (Chelsea)' do
65
+ let(:id) { 10 }
66
+
67
+ it 'returns address hash' do
68
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
69
+ subject.must_equal(street_address: '279 Kings Road',
70
+ extended_address: nil,
71
+ locality: 'Chelsea',
72
+ region: 'London',
73
+ postal_code: 'SW3 5EW',
74
+ country: 'United Kingdom')
75
+ end
76
+ end
77
+ end
78
+
79
+ # describe 'passed non-existant api' do
80
+ # let(:id) { 0 }
81
+ #
82
+ # it 'returns hash of nils' do
83
+ # subject.must_be_instance_of(Hash)
84
+ # subject.must_equal(street_address: nil,
85
+ # extended_address: nil,
86
+ # locality: "not an address",
87
+ # region: nil,
88
+ # postal_code: "not an address",
89
+ # country: "United Kingdom")
90
+ # end
91
+ # end
92
+ end
93
+ end
@@ -0,0 +1,30 @@
1
+ require_relative '../../../../../test_helper'
2
+ require_relative '../../../../../support/fixture_reader'
3
+
4
+ describe CineworldUk::Internal::Parser::Api::FilmLookup do
5
+ include Support::FixtureReader
6
+
7
+ let(:described_class) { CineworldUk::Internal::Parser::Api::FilmLookup }
8
+ let(:api_response) { Minitest::Mock.new }
9
+
10
+ before { WebMock.disable_net_connect! }
11
+
12
+ before do
13
+ api_response.expect(:film_list, film_list_json)
14
+ api_response.expect(:film_list_comingsoon, film_list_comingsoon_json)
15
+ end
16
+
17
+ describe '#to_hash' do
18
+ subject { described_class.new.to_hash }
19
+
20
+ it 'returns a Hash of Film objects, keyed by Integers' do
21
+ CineworldUk::Internal::ApiResponse.stub :new, api_response do
22
+ subject.must_be_instance_of(Hash)
23
+ subject.each do |key, value|
24
+ key.must_be_instance_of(Fixnum)
25
+ value.must_be_instance_of(CineworldUk::Internal::Parser::Api::Film)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end