cineworld_uk 4.1.0-aarch64-linux-gnu → 4.2.0-aarch64-linux-gnu
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +23 -1
- data/Rakefile +3 -24
- data/cineworld_uk.gemspec +2 -2
- data/lib/cineworld_uk/internal/api_response.rb +7 -30
- data/lib/cineworld_uk/internal/guest_token.rb +9 -52
- data/lib/cineworld_uk/internal/parser/api/film.rb +6 -0
- data/lib/cineworld_uk/internal/parser/api/performance.rb +5 -0
- data/lib/cineworld_uk/internal/title_sanitizer.rb +2 -10
- data/lib/cineworld_uk/performance.rb +4 -1
- data/lib/cineworld_uk/version.rb +2 -2
- data/lib/cineworld_uk.rb +2 -1
- data/test/fixtures/api/showtimes-014.json +67 -0
- data/test/fixtures/api/sites.json +52 -0
- data/test/lib/cineworld_uk/cinema_test.rb +63 -223
- data/test/lib/cineworld_uk/internal/api_response_test.rb +27 -182
- data/test/lib/cineworld_uk/internal/fixture_shape_test.rb +14 -0
- data/test/lib/cineworld_uk/internal/guest_token_test.rb +87 -0
- data/test/lib/cineworld_uk/internal/parser/api/cinema_address_test.rb +44 -85
- data/test/lib/cineworld_uk/internal/parser/api/film_test.rb +53 -131
- data/test/lib/cineworld_uk/internal/parser/api/performance_test.rb +27 -45
- data/test/lib/cineworld_uk/internal/title_sanitizer_test.rb +75 -126
- data/test/lib/cineworld_uk/performance_test.rb +153 -180
- data/test/lib/cineworld_uk/version_test.rb +3 -3
- data/test/live/api_shape_test.rb +22 -0
- data/test/live/integration_test.rb +13 -43
- data/test/live/live_helper.rb +11 -0
- data/test/package_test.rb +14 -7
- data/test/support/api_shapes.rb +48 -0
- data/test/support/vista_fixtures.rb +58 -0
- data/test/test_helper.rb +3 -0
- metadata +33 -28
- data/tasks/package.rake +0 -84
- data/test/fixtures/api/cinema-list.json +0 -1
- data/test/fixtures/api/dates-14.json +0 -1
- data/test/fixtures/api/performances-tomorrow-14.json +0 -1
- data/test/fixtures/api/vista-showtimes-brighton.json +0 -1
- data/test/support/fixture_reader.rb +0 -32
|
@@ -1,153 +1,102 @@
|
|
|
1
1
|
require_relative '../../../test_helper'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
subject { described_class.new(title).sanitized }
|
|
8
|
-
|
|
9
|
-
describe 'with 2d in title' do
|
|
10
|
-
let(:title) { 'Iron Man 3 2D' }
|
|
11
|
-
|
|
12
|
-
it 'removes dimension' do
|
|
13
|
-
_(subject).must_equal('Iron Man 3')
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
describe 'with 3d in title' do
|
|
18
|
-
let(:title) { 'Iron Man 3 3d' }
|
|
19
|
-
|
|
20
|
-
it 'removes dimension' do
|
|
21
|
-
_(subject).must_equal('Iron Man 3')
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe 'in hindi' do
|
|
26
|
-
let(:title) { 'Bang Bang! (Hindi)' }
|
|
27
|
-
|
|
28
|
-
it 'removes language' do
|
|
29
|
-
_(subject).must_equal('Bang Bang!')
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
describe 'Unlimited Screening' do
|
|
34
|
-
let(:title) { 'Nightcrawler - Unlimited Screening' }
|
|
35
|
-
|
|
36
|
-
it 'removes prefix' do
|
|
37
|
-
_(subject).must_equal('Nightcrawler')
|
|
38
|
-
end
|
|
39
|
-
end
|
|
3
|
+
class CineworldUk::Internal::TitleSanitizerTest < Minitest::Test
|
|
4
|
+
def test_removes_2d
|
|
5
|
+
assert_sanitized 'Iron Man 3', 'Iron Man 3 2D'
|
|
6
|
+
end
|
|
40
7
|
|
|
41
|
-
|
|
42
|
-
|
|
8
|
+
def test_removes_3d
|
|
9
|
+
assert_sanitized 'Iron Man 3', 'Iron Man 3 3d'
|
|
10
|
+
end
|
|
43
11
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
12
|
+
def test_removes_language
|
|
13
|
+
assert_sanitized 'Bang Bang!', 'Bang Bang! (Hindi)'
|
|
14
|
+
assert_sanitized 'Deadline', 'Deadline (Mandarin)'
|
|
15
|
+
end
|
|
48
16
|
|
|
49
|
-
|
|
50
|
-
|
|
17
|
+
def test_removes_dub_version
|
|
18
|
+
assert_sanitized 'Kung Fu Soccer', 'Kung Fu Soccer (Dubbed)'
|
|
19
|
+
end
|
|
51
20
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
end
|
|
21
|
+
def test_removes_unlimited_screening
|
|
22
|
+
assert_sanitized 'Nightcrawler', 'Nightcrawler - Unlimited Screening'
|
|
23
|
+
end
|
|
56
24
|
|
|
57
|
-
|
|
58
|
-
|
|
25
|
+
def test_removes_autism_prefix
|
|
26
|
+
assert_sanitized 'Dolphin Tale 2', 'Autism Friendly Screening: Dolphin Tale 2'
|
|
27
|
+
end
|
|
59
28
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
end
|
|
29
|
+
def test_keeps_bolshoi_ballet
|
|
30
|
+
assert_sanitized 'Bolshoi Ballet: The Legend of Love', 'Bolshoi Ballet: The Legend of Love'
|
|
31
|
+
end
|
|
64
32
|
|
|
65
|
-
|
|
66
|
-
|
|
33
|
+
def test_eno
|
|
34
|
+
assert_sanitized 'English National Opera: La Traviata', 'ENO: La Traviata '
|
|
35
|
+
end
|
|
67
36
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
end
|
|
37
|
+
def test_removes_imax_prefix
|
|
38
|
+
assert_sanitized 'Fury', '(IMAX) Fury'
|
|
39
|
+
end
|
|
72
40
|
|
|
73
|
-
|
|
74
|
-
|
|
41
|
+
def test_met_opera
|
|
42
|
+
assert_sanitized 'Met Opera: Le Nozze Di Figaro', 'MET Opera - Le Nozze Di Figaro'
|
|
43
|
+
end
|
|
75
44
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
45
|
+
def test_nt_live_encore
|
|
46
|
+
assert_sanitized 'National Theatre: Frankenstein (starring Benedict Cumberbatch)',
|
|
47
|
+
'NT Live Encore: Frankenstein (starring Benedict Cumberbatch)'
|
|
48
|
+
end
|
|
80
49
|
|
|
81
|
-
|
|
82
|
-
|
|
50
|
+
def test_nt_live
|
|
51
|
+
assert_sanitized 'National Theatre: Treasure Island', 'NT Live: Treasure Island'
|
|
52
|
+
end
|
|
83
53
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
54
|
+
def test_nt_live_with_encore_suffix
|
|
55
|
+
assert_sanitized 'National Theatre: A Streetcar Named Desire (Young Vic)',
|
|
56
|
+
'NT Live: A Streetcar Named Desire (Young Vic) - Encore'
|
|
57
|
+
end
|
|
88
58
|
|
|
89
|
-
|
|
90
|
-
|
|
59
|
+
def test_roh
|
|
60
|
+
assert_sanitized 'Royal Opera House: I Due Foscari', 'ROH - I Due Foscari'
|
|
61
|
+
end
|
|
91
62
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
end
|
|
63
|
+
def test_rbo_season
|
|
64
|
+
assert_sanitized 'Royal Ballet and Opera: Manon', 'RBO Cinema Season 2026-27: Manon'
|
|
65
|
+
end
|
|
96
66
|
|
|
97
|
-
|
|
98
|
-
|
|
67
|
+
def test_rsc
|
|
68
|
+
assert_sanitized "Royal Shakespeare Company: Love's Labour's Lost",
|
|
69
|
+
"RSC Live: Love's Labour's Lost"
|
|
70
|
+
end
|
|
99
71
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
end
|
|
72
|
+
def test_removes_sciscreen
|
|
73
|
+
assert_sanitized 'Dallas Buyers Club', 'SciScreen: Dallas Buyers Club'
|
|
74
|
+
end
|
|
104
75
|
|
|
105
|
-
|
|
106
|
-
|
|
76
|
+
def test_removes_special_performance
|
|
77
|
+
assert_sanitized 'Billy Elliot The Musical Live',
|
|
78
|
+
'Billy Elliot The Musical Live - Special Performance'
|
|
79
|
+
end
|
|
107
80
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
describe 'RSC screening' do
|
|
114
|
-
let(:title) { "RSC Live: Love's Labour's Lost" }
|
|
81
|
+
def test_removes_take_2
|
|
82
|
+
assert_sanitized 'Boyhood', 'Take 2 - Boyhood'
|
|
83
|
+
end
|
|
115
84
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
describe 'SciScreen screening' do
|
|
122
|
-
let(:title) { 'SciScreen: Dallas Buyers Club' }
|
|
85
|
+
def test_removes_singalong_and_movies_for_juniors
|
|
86
|
+
assert_sanitized 'Frozen', 'Frozen Sing-Along - Movies For Juniors'
|
|
87
|
+
end
|
|
123
88
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
describe 'special screening' do
|
|
130
|
-
let(:title) { 'Billy Elliot The Musical Live - Special Performance' }
|
|
89
|
+
def test_keeps_sing_along_within_title
|
|
90
|
+
assert_sanitized 'Bebefinn Sing-Along Movie', 'Bebefinn Sing-Along Movie'
|
|
91
|
+
end
|
|
131
92
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
describe 'Take 2 screening' do
|
|
138
|
-
let(:title) { 'Take 2 - Boyhood' }
|
|
93
|
+
def test_removes_festival_prefix
|
|
94
|
+
assert_sanitized 'Scum Of The Earth', 'Cine-Excess 2026: Scum Of The Earth'
|
|
95
|
+
end
|
|
139
96
|
|
|
140
|
-
|
|
141
|
-
_(subject).must_equal('Boyhood')
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
describe 'singalong and movies for juniors' do
|
|
146
|
-
let(:title) { 'Frozen Sing-Along - Movies For Juniors' }
|
|
97
|
+
private
|
|
147
98
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
end
|
|
151
|
-
end
|
|
99
|
+
def assert_sanitized(expected, title)
|
|
100
|
+
assert_equal expected, CineworldUk::Internal::TitleSanitizer.new(title).sanitized
|
|
152
101
|
end
|
|
153
102
|
end
|
|
@@ -1,183 +1,156 @@
|
|
|
1
1
|
require_relative '../../test_helper'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
subject { described_class.new(options).showing_on }
|
|
157
|
-
|
|
158
|
-
it 'returns date of showing' do
|
|
159
|
-
_(subject).must_be_instance_of(Date)
|
|
160
|
-
_(subject).must_equal Date.new(2013, 9, 12)
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
describe '#variant' do
|
|
165
|
-
subject { described_class.new(options).variant }
|
|
166
|
-
|
|
167
|
-
let(:options) do
|
|
168
|
-
{
|
|
169
|
-
film_name: 'Iron Man 3',
|
|
170
|
-
cinema_id: 3,
|
|
171
|
-
cinema_name: 'Cineworld Brighton',
|
|
172
|
-
starting_at: Time.utc(2013, 9, 12, 11, 0),
|
|
173
|
-
variant: ['Kids']
|
|
174
|
-
}
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
it 'is an alphabetically ordered array of lower-cased strings' do
|
|
178
|
-
_(subject).must_be_instance_of Array
|
|
179
|
-
subject.each { |element| _(element).must_be_instance_of String }
|
|
180
|
-
_(subject).must_equal %w(kids)
|
|
181
|
-
end
|
|
2
|
+
|
|
3
|
+
class CineworldUk::PerformanceTest < Minitest::Test
|
|
4
|
+
include Support::VistaFixtures
|
|
5
|
+
|
|
6
|
+
DATE = Date.new(2026, 10, 24)
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
setup_vista
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def teardown
|
|
13
|
+
teardown_vista
|
|
14
|
+
super
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_at_returns_performances
|
|
18
|
+
performances = performances_on_date
|
|
19
|
+
|
|
20
|
+
assert(performances.all? { |p| p.instance_of?(CineworldUk::Performance) })
|
|
21
|
+
assert_equal 6, performances.count
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def test_at_accepts_string_id
|
|
25
|
+
stub_showtimes(DATE)
|
|
26
|
+
|
|
27
|
+
assert_equal 6, CineworldUk::Performance.at('014', from: DATE, to: DATE).count
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_at_parses_first_performance
|
|
31
|
+
performance = performances_on_date.first
|
|
32
|
+
|
|
33
|
+
assert_equal 14, performance.cinema_id
|
|
34
|
+
assert_equal 'Brighton', performance.cinema_name
|
|
35
|
+
assert_equal 'The Example Film', performance.film_name
|
|
36
|
+
assert_equal Time.utc(2026, 10, 24, 8, 0), performance.starting_at
|
|
37
|
+
assert_equal '2d', performance.dimension
|
|
38
|
+
assert_equal %w(audio_described), performance.variant
|
|
39
|
+
assert_equal 'https://web.cineworld.co.uk/order/showtimes/014-1001/seats',
|
|
40
|
+
performance.booking_url
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def test_at_keeps_format_per_session
|
|
44
|
+
performances = performances_on_date
|
|
45
|
+
|
|
46
|
+
assert_equal '3d', performances[1].dimension
|
|
47
|
+
assert_equal %w(imax), performances[1].variant
|
|
48
|
+
assert_equal '2d', performances.last.dimension
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_at_returns_language_and_subtitles
|
|
52
|
+
performance = performances_on_date[2]
|
|
53
|
+
|
|
54
|
+
assert_equal 'Imaginary Picture', performance.film_name
|
|
55
|
+
assert_equal 'Tamil', performance.language
|
|
56
|
+
assert performance.subtitled?
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def test_at_marks_movies_for_juniors_as_kids
|
|
60
|
+
performance = performances_on_date[3]
|
|
61
|
+
|
|
62
|
+
assert_equal 'Pretend Pups', performance.film_name
|
|
63
|
+
assert_equal %w(kids), performance.variant
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def test_at_moves_festival_from_title
|
|
67
|
+
performance = performances_on_date[4]
|
|
68
|
+
|
|
69
|
+
assert_equal 'Scum Of The Earth', performance.film_name
|
|
70
|
+
assert_equal Cinebase::Festival.new(name: 'Cine-Excess', year: 2026), performance.festival
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def test_at_keeps_after_midnight_on_next_utc_day
|
|
74
|
+
assert_equal Time.utc(2026, 10, 24, 23, 15), performances_on_date.last.starting_at
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def test_at_includes_last_requested_day_without_fetching_sites
|
|
78
|
+
stub_showtimes(DATE, empty_showtimes_json)
|
|
79
|
+
stub_showtimes(DATE + 1)
|
|
80
|
+
|
|
81
|
+
performances = CineworldUk::Performance.at(14, from: DATE, to: DATE + 1)
|
|
82
|
+
|
|
83
|
+
assert_equal 6, performances.count
|
|
84
|
+
assert_not_requested :get, "#{BASE_URL}sites"
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def test_at_defaults_to_fourteen_days
|
|
88
|
+
(DATE..DATE + 13).each { |date| stub_showtimes(date, empty_showtimes_json) }
|
|
89
|
+
|
|
90
|
+
assert_equal [], CineworldUk::Performance.at(14, from: DATE)
|
|
91
|
+
assert_requested :get, %r{showtimes/by-business-date/}, times: 14
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def test_at_rejects_range_ending_before_start
|
|
95
|
+
assert_raises(ArgumentError) { CineworldUk::Performance.at(14, from: DATE, to: DATE - 1) }
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def test_new_sets_names
|
|
99
|
+
performance = CineworldUk::Performance.new(options)
|
|
100
|
+
|
|
101
|
+
assert_equal 'Iron Man 3', performance.film_name
|
|
102
|
+
assert_equal 'Cineworld Brighton', performance.cinema_name
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def test_new_sets_defaults
|
|
106
|
+
performance = CineworldUk::Performance.new(options)
|
|
107
|
+
|
|
108
|
+
assert_nil performance.booking_url
|
|
109
|
+
assert_equal '2d', performance.dimension
|
|
110
|
+
assert_nil performance.festival
|
|
111
|
+
assert_nil performance.language
|
|
112
|
+
refute performance.subtitled?
|
|
113
|
+
assert_equal [], performance.variant
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def test_dimension
|
|
117
|
+
assert_equal '3d', CineworldUk::Performance.new(options(dimension: '3d')).dimension
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def test_starting_at_keeps_utc
|
|
121
|
+
assert_equal Time.utc(2013, 9, 12, 11, 0), CineworldUk::Performance.new(options).starting_at
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def test_starting_at_converts_local_time_to_utc
|
|
125
|
+
starting_at = CineworldUk::Performance.new(
|
|
126
|
+
options(starting_at: Time.new(2013, 9, 12, 11, 0))
|
|
127
|
+
).starting_at
|
|
128
|
+
|
|
129
|
+
assert_equal Time.utc(2013, 9, 12, 10, 0), starting_at
|
|
130
|
+
assert starting_at.utc?
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def test_showing_on
|
|
134
|
+
assert_equal Date.new(2013, 9, 12), CineworldUk::Performance.new(options).showing_on
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def test_variant_is_sorted_and_lower_case
|
|
138
|
+
assert_equal %w(kids), CineworldUk::Performance.new(options(variant: ['Kids'])).variant
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
private
|
|
142
|
+
|
|
143
|
+
def options(overrides = {})
|
|
144
|
+
{
|
|
145
|
+
film_name: 'Iron Man 3',
|
|
146
|
+
cinema_id: 3,
|
|
147
|
+
cinema_name: 'Cineworld Brighton',
|
|
148
|
+
starting_at: Time.utc(2013, 9, 12, 11, 0)
|
|
149
|
+
}.merge(overrides)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def performances_on_date
|
|
153
|
+
stub_showtimes(DATE)
|
|
154
|
+
CineworldUk::Performance.at(14, from: DATE, to: DATE)
|
|
182
155
|
end
|
|
183
156
|
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require_relative 'live_helper'
|
|
2
|
+
|
|
3
|
+
class LiveApiShapeTest < Minitest::Test
|
|
4
|
+
include ApiShapes
|
|
5
|
+
|
|
6
|
+
def test_sites_are_readable
|
|
7
|
+
assert_sites_shape(client.get('sites'))
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def test_showtimes_are_readable
|
|
11
|
+
date = (Date.today + 1).iso8601
|
|
12
|
+
|
|
13
|
+
assert_showtimes_shape(client.get("showtimes/by-business-date/#{date}", 'siteIds' => '014'))
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def client
|
|
19
|
+
Cinebase::Vista::Client.new(base_url: CineworldUk::Internal::ApiResponse::BASE_URL,
|
|
20
|
+
region_code: 'GB', token: CineworldUk.token)
|
|
21
|
+
end
|
|
22
|
+
end
|