odeon_uk 3.0.6 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -3
  3. data/CHANGELOG.md +14 -0
  4. data/{LICENSE.txt → COMM-LICENSE} +0 -0
  5. data/LICENSE +617 -0
  6. data/README.md +58 -29
  7. data/Rakefile +7 -21
  8. data/lib/odeon_uk.rb +5 -14
  9. data/lib/odeon_uk/cinema.rb +123 -75
  10. data/lib/odeon_uk/{api/response.rb → internal/api_response.rb} +3 -3
  11. data/lib/odeon_uk/internal/parser/api/film_lookup.rb +34 -0
  12. data/lib/odeon_uk/internal/parser/api/performance_day.rb +92 -0
  13. data/lib/odeon_uk/internal/title_sanitizer.rb +34 -39
  14. data/lib/odeon_uk/performance.rb +87 -0
  15. data/lib/odeon_uk/version.rb +2 -2
  16. data/odeon_uk.gemspec +19 -21
  17. data/rake/fixture_creator.rb +5 -57
  18. data/test/fixtures/api/all_cinemas.plist +0 -0
  19. data/test/fixtures/api/app_init.plist +0 -0
  20. data/test/fixtures/api/film_times/71-14876.plist +0 -0
  21. data/test/fixtures/api/film_times/71-15408.plist +0 -0
  22. data/test/fixtures/api/film_times/71-15684.plist +0 -0
  23. data/test/fixtures/api/film_times/71-15866.plist +0 -0
  24. data/test/fixtures/api/film_times/71-15868.plist +0 -0
  25. data/test/fixtures/api/film_times/71-15961.plist +0 -0
  26. data/test/fixtures/api/film_times/71-15963.plist +0 -0
  27. data/test/fixtures/api/film_times/71-15965.plist +0 -0
  28. data/test/fixtures/api/film_times/71-15967.plist +0 -0
  29. data/test/fixtures/api/film_times/71-15969.plist +0 -0
  30. data/test/fixtures/api/film_times/71-15977.plist +0 -0
  31. data/test/fixtures/api/film_times/71-15980.plist +0 -0
  32. data/test/fixtures/api/film_times/71-16037.plist +0 -0
  33. data/test/fixtures/api/film_times/71-16136.plist +0 -0
  34. data/test/fixtures/api/film_times/71-16142.plist +0 -0
  35. data/test/fixtures/api/film_times/71-16143.plist +0 -0
  36. data/test/fixtures/api/film_times/71-16187.plist +0 -0
  37. data/test/fixtures/api/film_times/71-16369.plist +0 -0
  38. data/test/fixtures/api/film_times/71-16370.plist +0 -0
  39. data/test/fixtures/api/film_times/71-16374.plist +0 -0
  40. data/test/fixtures/api/film_times/71-16386.plist +0 -0
  41. data/test/fixtures/api/film_times/71-16387.plist +0 -0
  42. data/test/fixtures/api/film_times/71-16388.plist +0 -0
  43. data/test/fixtures/api/film_times/71-16438.plist +0 -0
  44. data/test/fixtures/api/film_times/71-16454.plist +0 -0
  45. data/test/fixtures/api/film_times/71-16457.plist +0 -0
  46. data/test/fixtures/api/film_times/71-16477.plist +0 -0
  47. data/test/fixtures/api/film_times/71-16478.plist +0 -0
  48. data/test/fixtures/api/film_times/71-16480.plist +0 -0
  49. data/test/fixtures/api/film_times/71-16482.plist +0 -0
  50. data/test/fixtures/api/film_times/71-16489.plist +0 -0
  51. data/test/lib/odeon_uk/cinema_test.rb +154 -373
  52. data/test/lib/odeon_uk/{api/response_test.rb → internal/api_response_test.rb} +7 -4
  53. data/test/lib/odeon_uk/performance_test.rb +149 -0
  54. data/test/lib/odeon_uk/version_test.rb +3 -5
  55. data/test/support/api_fixtures_helper.rb +9 -3
  56. data/test/support/fake_api_response.rb +17 -0
  57. data/test/test_helper.rb +9 -3
  58. metadata +89 -145
  59. data/.rdoc_options +0 -16
  60. data/lib/odeon_uk/api/cinema.rb +0 -67
  61. data/lib/odeon_uk/api/screenings.rb +0 -103
  62. data/lib/odeon_uk/configuration.rb +0 -21
  63. data/lib/odeon_uk/html/cinema.rb +0 -101
  64. data/lib/odeon_uk/html/parser/film_with_screenings.rb +0 -160
  65. data/lib/odeon_uk/html/screenings.rb +0 -38
  66. data/lib/odeon_uk/html/website.rb +0 -38
  67. data/lib/odeon_uk/screening.rb +0 -71
  68. data/test/fixtures/api/film_times/71-100747.plist +0 -0
  69. data/test/fixtures/api/film_times/71-100750.plist +0 -0
  70. data/test/fixtures/api/film_times/71-100790.plist +0 -0
  71. data/test/fixtures/api/film_times/71-14646.plist +0 -0
  72. data/test/fixtures/api/film_times/71-14725.plist +0 -0
  73. data/test/fixtures/api/film_times/71-15086.plist +0 -0
  74. data/test/fixtures/api/film_times/71-15096.plist +0 -0
  75. data/test/fixtures/api/film_times/71-15122.plist +0 -0
  76. data/test/fixtures/api/film_times/71-15130.plist +0 -0
  77. data/test/fixtures/api/film_times/71-15141.plist +0 -0
  78. data/test/fixtures/api/film_times/71-15142.plist +0 -0
  79. data/test/fixtures/api/film_times/71-15143.plist +0 -0
  80. data/test/fixtures/api/film_times/71-15144.plist +0 -0
  81. data/test/fixtures/api/film_times/71-15145.plist +0 -0
  82. data/test/fixtures/api/film_times/71-15170.plist +0 -0
  83. data/test/fixtures/api/film_times/71-15172.plist +0 -0
  84. data/test/fixtures/api/film_times/71-15177.plist +0 -0
  85. data/test/fixtures/api/film_times/71-15179.plist +0 -0
  86. data/test/fixtures/api/film_times/71-15182.plist +0 -0
  87. data/test/fixtures/api/film_times/71-15286.plist +0 -0
  88. data/test/fixtures/api/film_times/71-15360.plist +0 -0
  89. data/test/fixtures/api/film_times/71-15586.plist +0 -0
  90. data/test/fixtures/api/film_times/71-15700.plist +0 -0
  91. data/test/fixtures/api/film_times/71-15718.plist +0 -0
  92. data/test/fixtures/api/film_times/71-15768.plist +0 -0
  93. data/test/fixtures/api/film_times/71-15788.plist +0 -0
  94. data/test/fixtures/api/film_times/71-15793.plist +0 -0
  95. data/test/fixtures/api/film_times/71-15794.plist +0 -0
  96. data/test/fixtures/api/film_times/71-15795.plist +0 -0
  97. data/test/fixtures/api/film_times/71-15796.plist +0 -0
  98. data/test/fixtures/api/film_times/71-15799.plist +0 -0
  99. data/test/fixtures/api/film_times/71-15802.plist +0 -0
  100. data/test/fixtures/api/film_times/71-15814.plist +0 -0
  101. data/test/fixtures/api/film_times/71-15817.plist +0 -0
  102. data/test/fixtures/api/film_times/71-15840.plist +0 -0
  103. data/test/fixtures/html/cinema/105.html +0 -2622
  104. data/test/fixtures/html/cinema/211.html +0 -3241
  105. data/test/fixtures/html/cinema/71.html +0 -3448
  106. data/test/fixtures/html/showtimes/11-imax.html +0 -170
  107. data/test/fixtures/html/showtimes/171-d-box.html +0 -203
  108. data/test/fixtures/html/showtimes/71-0.html +0 -59
  109. data/test/fixtures/html/showtimes/71.html +0 -2395
  110. data/test/fixtures/html/sitemap.html +0 -1303
  111. data/test/lib/odeon_uk/api/cinema_test.rb +0 -165
  112. data/test/lib/odeon_uk/api/screenings_test.rb +0 -58
  113. data/test/lib/odeon_uk/configuration_test.rb +0 -29
  114. data/test/lib/odeon_uk/html/cinema_test.rb +0 -149
  115. data/test/lib/odeon_uk/html/parser/film_with_screenings_test.rb +0 -97
  116. data/test/lib/odeon_uk/html/screenings_test.rb +0 -44
  117. data/test/lib/odeon_uk/html/website_test.rb +0 -67
  118. data/test/lib/odeon_uk/screening_test.rb +0 -92
  119. data/test/support/website_fixtures_helper.rb +0 -30
@@ -1,479 +1,260 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  describe OdeonUk::Cinema do
4
- let(:described_class) { OdeonUk::Cinema }
5
-
6
- before do
7
- WebMock.disable_net_connect!
8
- end
9
-
10
- describe 'with HTML parsing' do
11
- include WebsiteFixturesHelper
12
-
13
- let(:website) { Minitest::Mock.new }
14
-
15
- describe '.all' do
16
- subject { described_class.all }
17
-
18
- before do
19
- website.expect(:sitemap, sitemap_html)
20
- end
21
-
22
- it 'returns an Array of OdeonUk::Cinemas' do
23
- OdeonUk::Html::Website.stub :new, website do
24
- subject.must_be_instance_of(Array)
25
- subject.each do |value|
26
- value.must_be_instance_of(described_class)
27
- end
28
- end
29
- end
30
-
31
- it 'returns the correctly sized array' do
32
- OdeonUk::Html::Website.stub :new, website do
33
- subject.size.must_equal 115
34
- end
35
- end
36
- end
37
-
38
- describe '.new(id)' do
39
- subject { described_class.new(id) }
4
+ include ApiFixturesHelper
40
5
 
41
- describe 'Brighton' do
42
- let(:id) { 71 }
6
+ let(:described_class) { OdeonUk::Cinema }
7
+ let(:api_response) { FakeApiResponse.new }
43
8
 
44
- before do
45
- website.expect(:sitemap, sitemap_html)
46
- end
9
+ before { WebMock.disable_net_connect! }
10
+ after { WebMock.allow_net_connect! }
47
11
 
48
- it 'returns a cinema' do
49
- OdeonUk::Html::Website.stub :new, website do
50
- subject.must_be_instance_of(described_class)
12
+ describe '.new(id)' do
13
+ subject { described_class.new(id) }
51
14
 
52
- subject.id.must_equal 71
53
- subject.brand.must_equal 'Odeon'
54
- subject.name.must_equal 'Brighton'
55
- subject.slug.must_equal 'odeon-brighton'
56
- subject.url.must_equal 'http://www.odeon.co.uk/cinemas/brighton/71/'
57
- end
58
- end
59
- end
60
- end
15
+ describe 'Brighton' do
16
+ let(:id) { 71 }
61
17
 
62
- describe '#adr' do
63
- subject { described_class.new(71).adr }
64
-
65
- describe '(brighton)' do
66
- before { website.expect(:cinema, cinema_html(71), [71]) }
67
-
68
- it 'returns the address hash' do
69
- OdeonUk::Html::Website.stub :new, website do
70
- subject.must_equal(
71
- street_address: 'Kingswest',
72
- locality: 'Brighton',
73
- postal_code: 'BN1 2RE',
74
- country_name: 'United Kingdom'
75
- )
76
- end
77
- end
18
+ it 'returns a cinema with a string id' do
19
+ subject.must_be_instance_of(described_class)
20
+ subject.id.must_equal(id.to_s)
78
21
  end
79
22
  end
23
+ end
80
24
 
81
- describe '#brand' do
82
- subject { described_class.new(id).brand }
83
-
84
- describe 'cinema name with London' do
85
- let(:id) { 105 }
86
-
87
- it 'removes "London" name prefix' do
88
- subject.must_equal 'Odeon'
89
- end
90
- end
91
- end
92
-
93
- describe '#full_name' do
94
- subject { described_class.new(71).full_name }
95
-
96
- describe 'simple name (brighton)' do
97
- before { website.expect(:sitemap, sitemap_html) }
25
+ describe '.all' do
26
+ subject { described_class.all }
98
27
 
99
- it 'returns the brand in the name' do
100
- OdeonUk::Html::Website.stub :new, website do
101
- subject.must_equal 'Odeon Brighton'
102
- end
28
+ it 'returns an array of cinemas' do
29
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
30
+ subject.must_be_instance_of(Array)
31
+ subject.each do |element|
32
+ element.must_be_instance_of(described_class)
103
33
  end
34
+ subject.count.must_be :>, 100
104
35
  end
105
36
  end
37
+ end
106
38
 
107
- describe '#locality' do
108
- subject { described_class.new(71).locality }
39
+ describe '#adr' do
40
+ subject { described_class.new(id).adr }
109
41
 
110
- before { website.expect(:cinema, cinema_html(71), [71]) }
42
+ describe 'short address' do
43
+ let(:id) { 71 }
111
44
 
112
- it 'returns town name' do
113
- OdeonUk::Html::Website.stub :new, website do
114
- subject.must_equal 'Brighton'
45
+ it 'returns the postcode' do
46
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
47
+ subject.must_equal(street_address: 'Kingswest',
48
+ extended_address: nil,
49
+ locality: 'Brighton',
50
+ region: nil,
51
+ postal_code: 'BN1 2RE',
52
+ country_name: 'United Kingdom')
115
53
  end
116
54
  end
117
55
  end
56
+ end
118
57
 
119
- describe '#name' do
120
- subject { described_class.new(id).name }
121
-
122
- before { website.expect(:sitemap, sitemap_html) }
58
+ describe '#address' do
59
+ subject { described_class.new(id).address }
123
60
 
124
- describe 'cinema name with London' do
125
- let(:id) { 105 }
61
+ describe 'London address' do
62
+ let(:id) { 105 }
126
63
 
127
- it 'removes "London" name prefix' do
128
- OdeonUk::Html::Website.stub :new, website do
129
- subject.must_equal 'Leicester Square'
130
- end
131
- end
132
- end
133
-
134
- describe 'cinema name with dashes' do
135
- let(:id) { 208 }
136
-
137
- it 'removes " - " and replaces it with a colon ": "' do
138
- OdeonUk::Html::Website.stub :new, website do
139
- subject.must_equal 'Whiteleys: The Lounge'
140
- end
64
+ it 'returns the postcode' do
65
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
66
+ subject.must_equal(street_address: '24-26 Leicester Square',
67
+ extended_address: nil,
68
+ locality: 'London',
69
+ region: nil,
70
+ postal_code: 'WC2H 7JY',
71
+ country_name: 'United Kingdom')
141
72
  end
142
73
  end
143
74
  end
75
+ end
144
76
 
145
- describe '#postal_code' do
146
- subject { described_class.new(id).postal_code }
147
-
148
- describe 'short address' do
149
- let(:id) { 71 }
150
-
151
- before { website.expect(:cinema, cinema_html(71), [71]) }
152
-
153
- it 'returns the postcode' do
154
- OdeonUk::Html::Website.stub :new, website do
155
- subject.must_equal 'BN1 2RE'
156
- end
157
- end
158
- end
159
-
160
- describe 'short address (London)' do
161
- let(:id) { 211 }
162
-
163
- before { website.expect(:cinema, cinema_html(211), [211]) }
164
-
165
- it 'returns the postcode' do
166
- OdeonUk::Html::Website.stub :new, website do
167
- subject.must_equal 'SE1 8XR'
168
- end
169
- end
170
- end
171
-
172
- describe 'short address (extra London Postcode)' do
173
- let(:id) { 105 }
174
-
175
- before { website.expect(:cinema, cinema_html(105), [105]) }
77
+ describe '#brand' do
78
+ subject { described_class.new(id).brand }
79
+ describe 'short address' do
80
+ let(:id) { 71 }
176
81
 
177
- it 'returns the postcode' do
178
- OdeonUk::Html::Website.stub :new, website do
179
- subject.must_equal 'WC2H 7LQ'
180
- end
82
+ it 'returns the postcode' do
83
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
84
+ subject.must_equal 'Odeon'
181
85
  end
182
86
  end
183
87
  end
88
+ end
184
89
 
185
- describe '#screenings' do
186
- subject { described_class.new(71).screenings }
90
+ describe '#country_name' do
91
+ subject { described_class.new(id).country_name }
92
+ describe 'short address' do
93
+ let(:id) { 71 }
187
94
 
188
- it 'calls out to Screening object' do
189
- OdeonUk::Screening.stub :at, [:screening] do
190
- subject.must_equal([:screening])
95
+ it 'returns the postcode' do
96
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
97
+ subject.must_equal 'United Kingdom'
191
98
  end
192
99
  end
193
100
  end
101
+ end
194
102
 
195
- describe '#slug' do
196
- subject { described_class.new(71).slug }
197
-
198
- describe 'simple name (brighton)' do
199
- before { website.expect(:sitemap, sitemap_html) }
103
+ describe '#extended_address' do
104
+ subject { described_class.new(id).extended_address }
105
+ describe 'short address' do
106
+ let(:id) { 71 }
200
107
 
201
- it 'returns the brand in the name' do
202
- OdeonUk::Html::Website.stub :new, website do
203
- subject.must_equal 'odeon-brighton'
204
- end
108
+ it 'returns the postcode' do
109
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
110
+ subject.must_equal ''
205
111
  end
206
112
  end
207
113
  end
114
+ end
208
115
 
209
- describe '#street_address' do
210
- subject { described_class.new(id).street_address }
211
-
212
- describe 'short address' do
213
- let(:id) { 71 }
214
-
215
- before { website.expect(:cinema, cinema_html(71), [71]) }
116
+ describe '#full_name' do
117
+ subject { described_class.new(id).full_name }
118
+ describe 'Brighton' do
119
+ let(:id) { 71 }
216
120
 
217
- it 'returns first line of address' do
218
- OdeonUk::Html::Website.stub :new, website do
219
- subject.must_equal 'Kingswest'
220
- end
121
+ it 'returns cinema name' do
122
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
123
+ subject.must_equal 'Odeon Brighton'
221
124
  end
222
125
  end
223
126
  end
224
127
 
225
- describe '#url' do
226
- subject { described_class.new(71).url }
227
-
228
- describe 'brighton' do
229
- before { website.expect(:sitemap, sitemap_html) }
128
+ describe 'Leicester Square' do
129
+ let(:id) { 105 }
230
130
 
231
- it 'returns the brand in the name' do
232
- OdeonUk::Html::Website.stub :new, website do
233
- subject.must_equal 'http://www.odeon.co.uk/cinemas/brighton/71/'
234
- end
131
+ it 'returns cinema name' do
132
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
133
+ subject.must_equal 'Odeon Leicester Square'
235
134
  end
236
135
  end
237
136
  end
238
137
  end
239
138
 
240
- describe 'with API parsing' do
241
- include ApiFixturesHelper
139
+ describe '#locality' do
140
+ subject { described_class.new(id).locality }
141
+ describe 'Short Address (Brighton)' do
142
+ let(:id) { 71 }
242
143
 
243
- before do
244
- OdeonUk.configure do |config|
245
- config.method = :api
246
- end
247
- end
248
-
249
- after do
250
- OdeonUk.configure do |config|
251
- config.method = :html
252
- end
253
- end
254
-
255
- let(:response) { Minitest::Mock.new }
256
-
257
- describe '.all' do
258
- subject { described_class.all }
259
-
260
- before do
261
- response.expect(:all_cinemas, parse(all_cinemas_plist))
262
- end
263
-
264
- it 'returns an Array of OdeonUk::Cinemas' do
265
- OdeonUk::Api::Response.stub :new, response do
266
- subject.must_be_instance_of(Array)
267
- subject.each do |value|
268
- value.must_be_instance_of(described_class)
269
- end
270
- end
271
- end
272
-
273
- it 'returns the correctly sized array' do
274
- OdeonUk::Api::Response.stub :new, response do
275
- subject.size.must_equal 115
276
- end
277
- end
278
- end
279
-
280
- describe '.new(id)' do
281
- subject { described_class.new(id) }
282
-
283
- describe 'Brighton' do
284
- let(:id) { 71 }
285
-
286
- before do
287
- response.expect(:all_cinemas, parse(all_cinemas_plist))
288
- end
289
-
290
- it 'returns a cinema' do
291
- OdeonUk::Api::Response.stub :new, response do
292
- subject.must_be_instance_of(described_class)
293
-
294
- subject.id.must_equal 71
295
- subject.brand.must_equal 'Odeon'
296
- subject.name.must_equal 'Brighton'
297
- subject.slug.must_equal 'odeon-brighton'
298
- subject.url.must_equal 'http://www.odeon.co.uk/cinemas/brighton/71/'
299
- end
300
- end
301
- end
302
- end
303
-
304
- describe '#adr' do
305
- subject { described_class.new(71).adr }
306
-
307
- describe '(brighton)' do
308
- before { response.expect(:all_cinemas, parse(all_cinemas_plist)) }
309
-
310
- it 'returns the address hash' do
311
- OdeonUk::Api::Response.stub :new, response do
312
- subject.must_equal(
313
- street_address: 'Kingswest',
314
- locality: 'Brighton',
315
- postal_code: 'BN1 2RE',
316
- country_name: 'United Kingdom'
317
- )
318
- end
144
+ it 'returns town name' do
145
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
146
+ subject.must_equal 'Brighton'
319
147
  end
320
148
  end
321
149
  end
150
+ end
322
151
 
323
- describe '#brand' do
324
- subject { described_class.new(id).brand }
325
-
326
- describe 'cinema name with London' do
327
- let(:id) { 105 }
152
+ describe '#name' do
153
+ subject { described_class.new(id).name }
154
+ describe 'Brighton' do
155
+ let(:id) { 71 }
328
156
 
329
- it 'removes "London" name prefix' do
330
- subject.must_equal 'Odeon'
157
+ it 'returns cinema name' do
158
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
159
+ subject.must_equal 'Brighton'
331
160
  end
332
161
  end
333
162
  end
334
163
 
335
- describe '#full_name' do
336
- subject { described_class.new(71).full_name }
164
+ describe 'Leicester Square' do
165
+ let(:id) { 105 }
337
166
 
338
- describe 'simple name (brighton)' do
339
- before { response.expect(:all_cinemas, parse(all_cinemas_plist)) }
340
-
341
- it 'returns the brand in the name' do
342
- OdeonUk::Api::Response.stub :new, response do
343
- subject.must_equal 'Odeon Brighton'
344
- end
167
+ it 'returns cinema name' do
168
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
169
+ subject.must_equal 'Leicester Square'
345
170
  end
346
171
  end
347
172
  end
173
+ end
348
174
 
349
- describe '#locality' do
350
- subject { described_class.new(71).locality }
351
-
352
- before { response.expect(:all_cinemas, parse(all_cinemas_plist)) }
175
+ describe '#postal_code' do
176
+ subject { described_class.new(id).postal_code }
177
+ describe 'short address' do
178
+ let(:id) { 71 }
353
179
 
354
- it 'returns town name' do
355
- OdeonUk::Api::Response.stub :new, response do
356
- subject.must_equal 'Brighton'
180
+ it 'returns the postcode' do
181
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
182
+ subject.must_equal 'BN1 2RE'
357
183
  end
358
184
  end
359
185
  end
360
186
 
361
- describe '#name' do
362
- subject { described_class.new(id).name }
363
-
364
- before { response.expect(:all_cinemas, parse(all_cinemas_plist)) }
187
+ describe 'short address (London)' do
188
+ let(:id) { 211 }
365
189
 
366
- describe 'cinema name with London' do
367
- let(:id) { 105 }
368
-
369
- it 'removes "London" name prefix' do
370
- OdeonUk::Api::Response.stub :new, response do
371
- subject.must_equal 'Leicester Square'
372
- end
373
- end
374
- end
375
-
376
- describe 'cinema name with dashes' do
377
- let(:id) { 208 }
378
-
379
- it 'removes " - " and replaces it with a colon ": "' do
380
- OdeonUk::Api::Response.stub :new, response do
381
- subject.must_equal 'Whiteleys: The Lounge'
382
- end
190
+ it 'returns the postcode' do
191
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
192
+ subject.must_equal 'SE1 8XR'
383
193
  end
384
194
  end
385
195
  end
386
196
 
387
- describe '#postal_code' do
388
- subject { described_class.new(id).postal_code }
389
-
390
- describe 'short address' do
391
- let(:id) { 71 }
392
-
393
- before { response.expect(:all_cinemas, parse(all_cinemas_plist)) }
197
+ describe 'short address (extra London Postcode)' do
198
+ let(:id) { 105 }
394
199
 
395
- it 'returns the postcode' do
396
- OdeonUk::Api::Response.stub :new, response do
397
- subject.must_equal 'BN1 2RE'
398
- end
399
- end
400
- end
401
-
402
- describe 'short address (London)' do
403
- let(:id) { 211 }
404
-
405
- before { response.expect(:all_cinemas, parse(all_cinemas_plist)) }
406
-
407
- it 'returns the postcode' do
408
- OdeonUk::Api::Response.stub :new, response do
409
- subject.must_equal 'SE1 8XR'
410
- end
411
- end
412
- end
413
-
414
- describe 'short address (extra London Postcode)' do
415
- let(:id) { 105 }
416
-
417
- before { response.expect(:all_cinemas, parse(all_cinemas_plist)) }
418
-
419
- it 'returns the postcode' do
420
- OdeonUk::Api::Response.stub :new, response do
421
- subject.must_equal 'WC2H 7LQ'
422
- end
200
+ it 'returns the postcode' do
201
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
202
+ subject.must_equal 'WC2H 7JY'
423
203
  end
424
204
  end
425
205
  end
206
+ end
426
207
 
427
- describe '#screenings' do
428
- subject { described_class.new(71).screenings }
208
+ describe '#region' do
209
+ subject { described_class.new(id).region }
210
+ describe 'short address' do
211
+ let(:id) { 71 }
429
212
 
430
- it 'calls out to Screening object' do
431
- OdeonUk::Screening.stub :at, [:screening] do
432
- subject.must_equal([:screening])
213
+ it 'returns the postcode' do
214
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
215
+ subject.must_equal ''
433
216
  end
434
217
  end
435
218
  end
219
+ end
436
220
 
437
- describe '#slug' do
438
- subject { described_class.new(71).slug }
221
+ describe '#slug' do
222
+ subject { described_class.new(id).slug }
439
223
 
440
- describe 'simple name (brighton)' do
441
- before { response.expect(:all_cinemas, parse(all_cinemas_plist)) }
224
+ describe 'short address' do
225
+ let(:id) { 71 }
442
226
 
443
- it 'returns the brand in the name' do
444
- OdeonUk::Api::Response.stub :new, response do
445
- subject.must_equal 'odeon-brighton'
446
- end
227
+ it 'returns first line of address' do
228
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
229
+ subject.must_equal 'odeon-brighton'
447
230
  end
448
231
  end
449
232
  end
233
+ end
450
234
 
451
- describe '#street_address' do
452
- subject { described_class.new(id).street_address }
453
-
454
- describe 'short address' do
455
- let(:id) { 71 }
235
+ describe '#street_address' do
236
+ subject { described_class.new(id).street_address }
456
237
 
457
- before { response.expect(:all_cinemas, parse(all_cinemas_plist)) }
238
+ describe 'short address' do
239
+ let(:id) { 71 }
458
240
 
459
- it 'returns first line of address' do
460
- OdeonUk::Api::Response.stub :new, response do
461
- subject.must_equal 'Kingswest'
462
- end
241
+ it 'returns first line of address' do
242
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
243
+ subject.must_equal 'Kingswest'
463
244
  end
464
245
  end
465
246
  end
247
+ end
466
248
 
467
- describe '#url' do
468
- subject { described_class.new(71).url }
249
+ describe '#url' do
250
+ subject { described_class.new(id).url }
469
251
 
470
- describe 'brighton' do
471
- before { response.expect(:all_cinemas, parse(all_cinemas_plist)) }
252
+ describe 'short address' do
253
+ let(:id) { 71 }
472
254
 
473
- it 'returns the brand in the name' do
474
- OdeonUk::Api::Response.stub :new, response do
475
- subject.must_equal 'http://www.odeon.co.uk/cinemas/brighton/71/'
476
- end
255
+ it 'returns first line of address' do
256
+ OdeonUk::Internal::ApiResponse.stub :new, api_response do
257
+ subject.must_equal 'http://www.odeon.co.uk/cinemas/brighton/71/'
477
258
  end
478
259
  end
479
260
  end