odeon_uk 3.0.6 → 4.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/.travis.yml +5 -3
- data/CHANGELOG.md +14 -0
- data/{LICENSE.txt → COMM-LICENSE} +0 -0
- data/LICENSE +617 -0
- data/README.md +58 -29
- data/Rakefile +7 -21
- data/lib/odeon_uk.rb +5 -14
- data/lib/odeon_uk/cinema.rb +123 -75
- data/lib/odeon_uk/{api/response.rb → internal/api_response.rb} +3 -3
- data/lib/odeon_uk/internal/parser/api/film_lookup.rb +34 -0
- data/lib/odeon_uk/internal/parser/api/performance_day.rb +92 -0
- data/lib/odeon_uk/internal/title_sanitizer.rb +34 -39
- data/lib/odeon_uk/performance.rb +87 -0
- data/lib/odeon_uk/version.rb +2 -2
- data/odeon_uk.gemspec +19 -21
- data/rake/fixture_creator.rb +5 -57
- data/test/fixtures/api/all_cinemas.plist +0 -0
- data/test/fixtures/api/app_init.plist +0 -0
- data/test/fixtures/api/film_times/71-14876.plist +0 -0
- data/test/fixtures/api/film_times/71-15408.plist +0 -0
- data/test/fixtures/api/film_times/71-15684.plist +0 -0
- data/test/fixtures/api/film_times/71-15866.plist +0 -0
- data/test/fixtures/api/film_times/71-15868.plist +0 -0
- data/test/fixtures/api/film_times/71-15961.plist +0 -0
- data/test/fixtures/api/film_times/71-15963.plist +0 -0
- data/test/fixtures/api/film_times/71-15965.plist +0 -0
- data/test/fixtures/api/film_times/71-15967.plist +0 -0
- data/test/fixtures/api/film_times/71-15969.plist +0 -0
- data/test/fixtures/api/film_times/71-15977.plist +0 -0
- data/test/fixtures/api/film_times/71-15980.plist +0 -0
- data/test/fixtures/api/film_times/71-16037.plist +0 -0
- data/test/fixtures/api/film_times/71-16136.plist +0 -0
- data/test/fixtures/api/film_times/71-16142.plist +0 -0
- data/test/fixtures/api/film_times/71-16143.plist +0 -0
- data/test/fixtures/api/film_times/71-16187.plist +0 -0
- data/test/fixtures/api/film_times/71-16369.plist +0 -0
- data/test/fixtures/api/film_times/71-16370.plist +0 -0
- data/test/fixtures/api/film_times/71-16374.plist +0 -0
- data/test/fixtures/api/film_times/71-16386.plist +0 -0
- data/test/fixtures/api/film_times/71-16387.plist +0 -0
- data/test/fixtures/api/film_times/71-16388.plist +0 -0
- data/test/fixtures/api/film_times/71-16438.plist +0 -0
- data/test/fixtures/api/film_times/71-16454.plist +0 -0
- data/test/fixtures/api/film_times/71-16457.plist +0 -0
- data/test/fixtures/api/film_times/71-16477.plist +0 -0
- data/test/fixtures/api/film_times/71-16478.plist +0 -0
- data/test/fixtures/api/film_times/71-16480.plist +0 -0
- data/test/fixtures/api/film_times/71-16482.plist +0 -0
- data/test/fixtures/api/film_times/71-16489.plist +0 -0
- data/test/lib/odeon_uk/cinema_test.rb +154 -373
- data/test/lib/odeon_uk/{api/response_test.rb → internal/api_response_test.rb} +7 -4
- data/test/lib/odeon_uk/performance_test.rb +149 -0
- data/test/lib/odeon_uk/version_test.rb +3 -5
- data/test/support/api_fixtures_helper.rb +9 -3
- data/test/support/fake_api_response.rb +17 -0
- data/test/test_helper.rb +9 -3
- metadata +89 -145
- data/.rdoc_options +0 -16
- data/lib/odeon_uk/api/cinema.rb +0 -67
- data/lib/odeon_uk/api/screenings.rb +0 -103
- data/lib/odeon_uk/configuration.rb +0 -21
- data/lib/odeon_uk/html/cinema.rb +0 -101
- data/lib/odeon_uk/html/parser/film_with_screenings.rb +0 -160
- data/lib/odeon_uk/html/screenings.rb +0 -38
- data/lib/odeon_uk/html/website.rb +0 -38
- data/lib/odeon_uk/screening.rb +0 -71
- data/test/fixtures/api/film_times/71-100747.plist +0 -0
- data/test/fixtures/api/film_times/71-100750.plist +0 -0
- data/test/fixtures/api/film_times/71-100790.plist +0 -0
- data/test/fixtures/api/film_times/71-14646.plist +0 -0
- data/test/fixtures/api/film_times/71-14725.plist +0 -0
- data/test/fixtures/api/film_times/71-15086.plist +0 -0
- data/test/fixtures/api/film_times/71-15096.plist +0 -0
- data/test/fixtures/api/film_times/71-15122.plist +0 -0
- data/test/fixtures/api/film_times/71-15130.plist +0 -0
- data/test/fixtures/api/film_times/71-15141.plist +0 -0
- data/test/fixtures/api/film_times/71-15142.plist +0 -0
- data/test/fixtures/api/film_times/71-15143.plist +0 -0
- data/test/fixtures/api/film_times/71-15144.plist +0 -0
- data/test/fixtures/api/film_times/71-15145.plist +0 -0
- data/test/fixtures/api/film_times/71-15170.plist +0 -0
- data/test/fixtures/api/film_times/71-15172.plist +0 -0
- data/test/fixtures/api/film_times/71-15177.plist +0 -0
- data/test/fixtures/api/film_times/71-15179.plist +0 -0
- data/test/fixtures/api/film_times/71-15182.plist +0 -0
- data/test/fixtures/api/film_times/71-15286.plist +0 -0
- data/test/fixtures/api/film_times/71-15360.plist +0 -0
- data/test/fixtures/api/film_times/71-15586.plist +0 -0
- data/test/fixtures/api/film_times/71-15700.plist +0 -0
- data/test/fixtures/api/film_times/71-15718.plist +0 -0
- data/test/fixtures/api/film_times/71-15768.plist +0 -0
- data/test/fixtures/api/film_times/71-15788.plist +0 -0
- data/test/fixtures/api/film_times/71-15793.plist +0 -0
- data/test/fixtures/api/film_times/71-15794.plist +0 -0
- data/test/fixtures/api/film_times/71-15795.plist +0 -0
- data/test/fixtures/api/film_times/71-15796.plist +0 -0
- data/test/fixtures/api/film_times/71-15799.plist +0 -0
- data/test/fixtures/api/film_times/71-15802.plist +0 -0
- data/test/fixtures/api/film_times/71-15814.plist +0 -0
- data/test/fixtures/api/film_times/71-15817.plist +0 -0
- data/test/fixtures/api/film_times/71-15840.plist +0 -0
- data/test/fixtures/html/cinema/105.html +0 -2622
- data/test/fixtures/html/cinema/211.html +0 -3241
- data/test/fixtures/html/cinema/71.html +0 -3448
- data/test/fixtures/html/showtimes/11-imax.html +0 -170
- data/test/fixtures/html/showtimes/171-d-box.html +0 -203
- data/test/fixtures/html/showtimes/71-0.html +0 -59
- data/test/fixtures/html/showtimes/71.html +0 -2395
- data/test/fixtures/html/sitemap.html +0 -1303
- data/test/lib/odeon_uk/api/cinema_test.rb +0 -165
- data/test/lib/odeon_uk/api/screenings_test.rb +0 -58
- data/test/lib/odeon_uk/configuration_test.rb +0 -29
- data/test/lib/odeon_uk/html/cinema_test.rb +0 -149
- data/test/lib/odeon_uk/html/parser/film_with_screenings_test.rb +0 -97
- data/test/lib/odeon_uk/html/screenings_test.rb +0 -44
- data/test/lib/odeon_uk/html/website_test.rb +0 -67
- data/test/lib/odeon_uk/screening_test.rb +0 -92
- data/test/support/website_fixtures_helper.rb +0 -30
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,479 +1,260 @@
|
|
1
1
|
require_relative '../../test_helper'
|
2
2
|
|
3
3
|
describe OdeonUk::Cinema do
|
4
|
-
|
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
|
-
|
42
|
-
|
6
|
+
let(:described_class) { OdeonUk::Cinema }
|
7
|
+
let(:api_response) { FakeApiResponse.new }
|
43
8
|
|
44
|
-
|
45
|
-
|
46
|
-
end
|
9
|
+
before { WebMock.disable_net_connect! }
|
10
|
+
after { WebMock.allow_net_connect! }
|
47
11
|
|
48
|
-
|
49
|
-
|
50
|
-
subject.must_be_instance_of(described_class)
|
12
|
+
describe '.new(id)' do
|
13
|
+
subject { described_class.new(id) }
|
51
14
|
|
52
|
-
|
53
|
-
|
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
|
-
|
63
|
-
|
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
|
-
|
82
|
-
|
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
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
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
|
-
|
108
|
-
|
39
|
+
describe '#adr' do
|
40
|
+
subject { described_class.new(id).adr }
|
109
41
|
|
110
|
-
|
42
|
+
describe 'short address' do
|
43
|
+
let(:id) { 71 }
|
111
44
|
|
112
|
-
it 'returns
|
113
|
-
OdeonUk::
|
114
|
-
subject.must_equal
|
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
|
-
|
120
|
-
|
121
|
-
|
122
|
-
before { website.expect(:sitemap, sitemap_html) }
|
58
|
+
describe '#address' do
|
59
|
+
subject { described_class.new(id).address }
|
123
60
|
|
124
|
-
|
125
|
-
|
61
|
+
describe 'London address' do
|
62
|
+
let(:id) { 105 }
|
126
63
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
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
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
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
|
-
|
178
|
-
|
179
|
-
|
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
|
-
|
186
|
-
|
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 '
|
189
|
-
OdeonUk::
|
190
|
-
subject.must_equal
|
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
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
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
|
-
|
202
|
-
|
203
|
-
|
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
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
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
|
-
|
218
|
-
|
219
|
-
|
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 '
|
226
|
-
|
227
|
-
|
228
|
-
describe 'brighton' do
|
229
|
-
before { website.expect(:sitemap, sitemap_html) }
|
128
|
+
describe 'Leicester Square' do
|
129
|
+
let(:id) { 105 }
|
230
130
|
|
231
|
-
|
232
|
-
|
233
|
-
|
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 '
|
241
|
-
|
139
|
+
describe '#locality' do
|
140
|
+
subject { described_class.new(id).locality }
|
141
|
+
describe 'Short Address (Brighton)' do
|
142
|
+
let(:id) { 71 }
|
242
143
|
|
243
|
-
|
244
|
-
|
245
|
-
|
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
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
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
|
-
|
330
|
-
|
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 '
|
336
|
-
|
164
|
+
describe 'Leicester Square' do
|
165
|
+
let(:id) { 105 }
|
337
166
|
|
338
|
-
|
339
|
-
|
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
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
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
|
355
|
-
OdeonUk::
|
356
|
-
subject.must_equal '
|
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 '
|
362
|
-
|
363
|
-
|
364
|
-
before { response.expect(:all_cinemas, parse(all_cinemas_plist)) }
|
187
|
+
describe 'short address (London)' do
|
188
|
+
let(:id) { 211 }
|
365
189
|
|
366
|
-
|
367
|
-
|
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 '
|
388
|
-
|
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
|
-
|
396
|
-
|
397
|
-
|
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
|
-
|
428
|
-
|
208
|
+
describe '#region' do
|
209
|
+
subject { described_class.new(id).region }
|
210
|
+
describe 'short address' do
|
211
|
+
let(:id) { 71 }
|
429
212
|
|
430
|
-
it '
|
431
|
-
OdeonUk::
|
432
|
-
subject.must_equal
|
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
|
-
|
438
|
-
|
221
|
+
describe '#slug' do
|
222
|
+
subject { described_class.new(id).slug }
|
439
223
|
|
440
|
-
|
441
|
-
|
224
|
+
describe 'short address' do
|
225
|
+
let(:id) { 71 }
|
442
226
|
|
443
|
-
|
444
|
-
|
445
|
-
|
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
|
-
|
452
|
-
|
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
|
-
|
238
|
+
describe 'short address' do
|
239
|
+
let(:id) { 71 }
|
458
240
|
|
459
|
-
|
460
|
-
|
461
|
-
|
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
|
-
|
468
|
-
|
249
|
+
describe '#url' do
|
250
|
+
subject { described_class.new(id).url }
|
469
251
|
|
470
|
-
|
471
|
-
|
252
|
+
describe 'short address' do
|
253
|
+
let(:id) { 71 }
|
472
254
|
|
473
|
-
|
474
|
-
|
475
|
-
|
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
|