cineworld_uk 4.1.0-x86_64-linux-gnu → 4.3.1-x86_64-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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +73 -0
  3. data/CHANGELOG.md +33 -0
  4. data/README.md +31 -1
  5. data/Rakefile +3 -24
  6. data/cineworld_uk.gemspec +2 -2
  7. data/lib/cineworld_uk/internal/api_response.rb +9 -31
  8. data/lib/cineworld_uk/internal/guest_token.rb +9 -52
  9. data/lib/cineworld_uk/internal/parser/api/film.rb +14 -1
  10. data/lib/cineworld_uk/internal/parser/api/performance.rb +5 -0
  11. data/lib/cineworld_uk/internal/title_sanitizer.rb +5 -10
  12. data/lib/cineworld_uk/performance.rb +5 -1
  13. data/lib/cineworld_uk/version.rb +2 -2
  14. data/lib/cineworld_uk.rb +2 -1
  15. data/test/fixtures/api/showtimes-014.json +76 -0
  16. data/test/fixtures/api/sites.json +52 -0
  17. data/test/lib/cineworld_uk/cinema_test.rb +63 -223
  18. data/test/lib/cineworld_uk/internal/api_response_test.rb +27 -182
  19. data/test/lib/cineworld_uk/internal/fixture_shape_test.rb +14 -0
  20. data/test/lib/cineworld_uk/internal/guest_token_test.rb +87 -0
  21. data/test/lib/cineworld_uk/internal/parser/api/cinema_address_test.rb +44 -85
  22. data/test/lib/cineworld_uk/internal/parser/api/film_test.rb +65 -127
  23. data/test/lib/cineworld_uk/internal/parser/api/performance_test.rb +27 -45
  24. data/test/lib/cineworld_uk/internal/title_sanitizer_test.rb +94 -120
  25. data/test/lib/cineworld_uk/performance_test.rb +165 -180
  26. data/test/lib/cineworld_uk/version_test.rb +3 -3
  27. data/test/live/api_shape_test.rb +22 -0
  28. data/test/live/integration_test.rb +13 -43
  29. data/test/live/live_helper.rb +11 -0
  30. data/test/package_test.rb +14 -7
  31. data/test/support/api_shapes.rb +48 -0
  32. data/test/support/vista_fixtures.rb +58 -0
  33. data/test/test_helper.rb +3 -0
  34. metadata +35 -29
  35. data/tasks/package.rake +0 -84
  36. data/test/fixtures/api/cinema-list.json +0 -1
  37. data/test/fixtures/api/dates-14.json +0 -1
  38. data/test/fixtures/api/performances-tomorrow-14.json +0 -1
  39. data/test/fixtures/api/vista-showtimes-brighton.json +0 -1
  40. data/test/support/fixture_reader.rb +0 -32
@@ -1,153 +1,127 @@
1
1
  require_relative '../../../test_helper'
2
2
 
3
- describe CineworldUk::Internal::TitleSanitizer do
4
- let(:described_class) { CineworldUk::Internal::TitleSanitizer }
5
-
6
- describe '#sanitized' do
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
3
+ class CineworldUk::Internal::TitleSanitizerTest < Minitest::Test
4
+ def test_removes_2d
5
+ assert_sanitized 'Iron Man 3', 'Iron Man 3 2D'
6
+ end
16
7
 
17
- describe 'with 3d in title' do
18
- let(:title) { 'Iron Man 3 3d' }
8
+ def test_removes_3d
9
+ assert_sanitized 'Iron Man 3', 'Iron Man 3 3d'
10
+ end
19
11
 
20
- it 'removes dimension' do
21
- _(subject).must_equal('Iron Man 3')
22
- end
23
- end
12
+ def test_removes_language
13
+ assert_sanitized 'Bang Bang!', 'Bang Bang! (Hindi)'
14
+ assert_sanitized 'Deadline', 'Deadline (Mandarin)'
15
+ end
24
16
 
25
- describe 'in hindi' do
26
- let(:title) { 'Bang Bang! (Hindi)' }
17
+ def test_removes_dub_version
18
+ assert_sanitized 'Kung Fu Soccer', 'Kung Fu Soccer (Dubbed)'
19
+ end
27
20
 
28
- it 'removes language' do
29
- _(subject).must_equal('Bang Bang!')
30
- end
31
- end
21
+ def test_removes_unlimited_screening
22
+ assert_sanitized 'Nightcrawler', 'Nightcrawler - Unlimited Screening'
23
+ end
32
24
 
33
- describe 'Unlimited Screening' do
34
- let(:title) { 'Nightcrawler - Unlimited Screening' }
25
+ def test_removes_autism_prefix
26
+ assert_sanitized 'Dolphin Tale 2', 'Autism Friendly Screening: Dolphin Tale 2'
27
+ end
35
28
 
36
- it 'removes prefix' do
37
- _(subject).must_equal('Nightcrawler')
38
- end
39
- end
29
+ def test_keeps_bolshoi_ballet
30
+ assert_sanitized 'Bolshoi Ballet: The Legend of Love', 'Bolshoi Ballet: The Legend of Love'
31
+ end
40
32
 
41
- describe 'Austism screening' do
42
- let(:title) { 'Autism Friendly Screening: Dolphin Tale 2' }
33
+ def test_eno
34
+ assert_sanitized 'English National Opera: La Traviata', 'ENO: La Traviata '
35
+ end
43
36
 
44
- it 'removes prefix' do
45
- _(subject).must_equal('Dolphin Tale 2')
46
- end
47
- end
37
+ def test_removes_imax_prefix
38
+ assert_sanitized 'Fury', '(IMAX) Fury'
39
+ end
48
40
 
49
- describe 'Bolshoi screening' do
50
- let(:title) { 'Bolshoi Ballet: The Legend of Love' }
41
+ def test_met_opera
42
+ assert_sanitized 'Met Opera: Le Nozze Di Figaro', 'MET Opera - Le Nozze Di Figaro'
43
+ end
51
44
 
52
- it 'removes prefix' do
53
- _(subject).must_equal('Bolshoi Ballet: The Legend of Love')
54
- end
55
- end
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
56
49
 
57
- describe 'English National Opera screening' do
58
- let(:title) { 'ENO: La Traviata ' }
50
+ def test_nt_live
51
+ assert_sanitized 'National Theatre: Treasure Island', 'NT Live: Treasure Island'
52
+ end
59
53
 
60
- it 'removes prefix' do
61
- _(subject).must_equal('English National Opera: La Traviata')
62
- end
63
- end
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
64
58
 
65
- describe 'with IMAX' do
66
- let(:title) { '(IMAX) Fury' }
59
+ def test_roh
60
+ assert_sanitized 'Royal Opera House: I Due Foscari', 'ROH - I Due Foscari'
61
+ end
67
62
 
68
- it 'removes prefix' do
69
- _(subject).must_equal('Fury')
70
- end
71
- end
63
+ def test_rbo_season
64
+ assert_sanitized 'Royal Ballet and Opera: Manon', 'RBO Cinema Season 2026-27: Manon'
65
+ end
72
66
 
73
- describe 'Met Opera screening' do
74
- let(:title) { 'MET Opera - Le Nozze Di Figaro' }
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
75
71
 
76
- it 'removes prefix' do
77
- _(subject).must_equal('Met Opera: Le Nozze Di Figaro')
78
- end
79
- end
72
+ def test_removes_sciscreen
73
+ assert_sanitized 'Dallas Buyers Club', 'SciScreen: Dallas Buyers Club'
74
+ end
80
75
 
81
- describe 'NT Live screening' do
82
- let(:title) { 'NT Live Encore: Frankenstein (starring Benedict Cumberbatch)' }
76
+ def test_removes_special_performance
77
+ assert_sanitized 'Billy Elliot The Musical Live',
78
+ 'Billy Elliot The Musical Live - Special Performance'
79
+ end
83
80
 
84
- it 'removes prefix' do
85
- _(subject).must_equal('National Theatre: Frankenstein (starring Benedict Cumberbatch)')
86
- end
87
- end
81
+ def test_removes_take_2
82
+ assert_sanitized 'Boyhood', 'Take 2 - Boyhood'
83
+ end
88
84
 
89
- describe 'National Theatre screening' do
90
- let(:title) { 'NT Live: Treasure Island' }
85
+ def test_removes_singalong_and_movies_for_juniors
86
+ assert_sanitized 'Frozen', 'Frozen Sing-Along - Movies For Juniors'
87
+ end
91
88
 
92
- it 'removes prefix' do
93
- _(subject).must_equal('National Theatre: Treasure Island')
94
- end
95
- end
89
+ def test_keeps_sing_along_within_title
90
+ assert_sanitized 'Bebefinn Sing-Along Movie', 'Bebefinn Sing-Along Movie'
91
+ end
96
92
 
97
- describe 'National Theatre Encore screening' do
98
- let(:title) { 'NT Live: A Streetcar Named Desire (Young Vic) - Encore' }
93
+ def test_removes_format_prefix
94
+ assert_sanitized 'Wildwood', '(4DX) Wildwood'
95
+ assert_sanitized 'Wildwood', '(ScreenX) Wildwood'
96
+ end
99
97
 
100
- it 'removes prefix' do
101
- _(subject).must_equal('National Theatre: A Streetcar Named Desire (Young Vic)')
102
- end
103
- end
98
+ def test_removes_movies_for_juniors_prefix
99
+ assert_sanitized 'Paw Patrol: The Mighty Movie', 'M4J: Paw Patrol: The Mighty Movie'
100
+ end
104
101
 
105
- describe 'ROH screening' do
106
- let(:title) { 'ROH - I Due Foscari' }
102
+ def test_removes_family_films_prefix
103
+ assert_sanitized 'Paw Patrol: The Dino Movie', '£2 Family Films : Paw Patrol: The Dino Movie'
104
+ end
107
105
 
108
- it 'removes prefix' do
109
- _(subject).must_equal('Royal Opera House: I Due Foscari')
110
- end
111
- end
112
-
113
- describe 'RSC screening' do
114
- let(:title) { "RSC Live: Love's Labour's Lost" }
106
+ def test_removes_film_year
107
+ assert_sanitized 'Street Fighter', 'Street Fighter (2026)'
108
+ end
115
109
 
116
- it 'removes prefix' do
117
- _(subject).must_equal("Royal Shakespeare Company: Love's Labour's Lost")
118
- end
119
- end
120
-
121
- describe 'SciScreen screening' do
122
- let(:title) { 'SciScreen: Dallas Buyers Club' }
110
+ def test_removes_season_prefix_and_year
111
+ assert_sanitized 'From Dusk Till Dawn', 'Horror Season 2026 From Dusk Till Dawn (1996)'
112
+ end
123
113
 
124
- it 'removes prefix' do
125
- _(subject).must_equal('Dallas Buyers Club')
126
- end
127
- end
128
-
129
- describe 'special screening' do
130
- let(:title) { 'Billy Elliot The Musical Live - Special Performance' }
114
+ def test_removes_re_release
115
+ assert_sanitized 'Zindagi Na Milegi Dobara', 'Zindagi Na Milegi Dobara (Re-release) (Hindi)'
116
+ end
131
117
 
132
- it 'removes prefix' do
133
- _(subject).must_equal('Billy Elliot The Musical Live')
134
- end
135
- end
136
-
137
- describe 'Take 2 screening' do
138
- let(:title) { 'Take 2 - Boyhood' }
118
+ def test_removes_festival_prefix
119
+ assert_sanitized 'Scum Of The Earth', 'Cine-Excess 2026: Scum Of The Earth'
120
+ end
139
121
 
140
- it 'removes prefix' do
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' }
122
+ private
147
123
 
148
- it 'removes prefix' do
149
- _(subject).must_equal('Frozen')
150
- end
151
- end
124
+ def assert_sanitized(expected, title)
125
+ assert_equal expected, CineworldUk::Internal::TitleSanitizer.new(title).sanitized
152
126
  end
153
127
  end
@@ -1,183 +1,168 @@
1
1
  require_relative '../../test_helper'
2
- require_relative '../../support/fixture_reader'
3
-
4
- describe CineworldUk::Performance do
5
- include Support::FixtureReader
6
-
7
- let(:described_class) { CineworldUk::Performance }
8
- let(:api_response) { Minitest::Mock.new }
9
-
10
- before { WebMock.disable_net_connect! }
11
- after { WebMock.allow_net_connect! }
12
-
13
- describe '.at(cinema_id)' do
14
- subject do
15
- described_class.at(cinema_id, from: Date.today + 1, to: Date.today + 1)
16
- end
17
-
18
- before do
19
- api_response.expect(:cinema_list, cinema_list_json)
20
- 4.times { api_response.expect(:performances,
21
- performances_tomorrow_json(14),
22
- [14, Date.today + 1]) }
23
- end
24
-
25
- describe 'called with integer' do
26
- let(:cinema_id) { 14 }
27
-
28
- it 'returns an array of performances' do
29
- CineworldUk::Internal::ApiResponse.stub :new, api_response do
30
- _(subject).must_be_instance_of(Array)
31
- subject.each do |performance|
32
- _(performance).must_be_instance_of(described_class)
33
- end
34
- end
35
- end
36
-
37
- it 'returns at least a sensible number' do
38
- CineworldUk::Internal::ApiResponse.stub :new, api_response do
39
- _(subject.count).must_be :>, 5
40
- end
41
- end
42
- end
43
-
44
- describe 'called with string' do
45
- let(:cinema_id) { '14' }
46
-
47
- it 'returns an array of performances' do
48
- CineworldUk::Internal::ApiResponse.stub :new, api_response do
49
- _(subject).must_be_instance_of(Array)
50
- subject.each do |performance|
51
- _(performance).must_be_instance_of(described_class)
52
- end
53
- end
54
- end
55
-
56
- it 'returns at least a sensible number' do
57
- CineworldUk::Internal::ApiResponse.stub :new, api_response do
58
- _(subject.count).must_be :>, 5
59
- end
60
- end
61
- end
62
- end
63
-
64
- describe '.new' do
65
- subject { described_class.new(options) }
66
-
67
- describe 'simple' do
68
- let(:options) do
69
- {
70
- film_name: 'Iron Man 3',
71
- cinema_id: 3,
72
- cinema_name: 'Cineworld Brighton',
73
- starting_at: Time.utc(2013, 9, 12, 11, 0)
74
- }
75
- end
76
-
77
- it 'sets cinema name and film name' do
78
- _(subject.film_name).must_equal 'Iron Man 3'
79
- _(subject.cinema_name).must_equal 'Cineworld Brighton'
80
- end
81
-
82
- it 'booking url, dimension & varient are set to defaults' do
83
- _(subject.booking_url).must_be_nil
84
- _(subject.dimension).must_equal '2d'
85
- _(subject.variant).must_equal []
86
- end
87
- end
88
- end
89
-
90
- describe '#dimension' do
91
- let(:options) do
92
- {
93
- film_name: 'Iron Man 3',
94
- dimension: '3d',
95
- cinema_id: 3,
96
- cinema_name: 'Cineworld Brighton',
97
- starting_at: Time.utc(2013, 9, 12, 11, 0)
98
- }
99
- end
100
-
101
- subject { described_class.new(options).dimension }
102
-
103
- it 'returns 2d or 3d' do
104
- _(subject).must_be_instance_of(String)
105
- _(subject).must_equal '3d'
106
- end
107
- end
108
-
109
- describe '#starting_at' do
110
- subject { described_class.new(options).starting_at }
111
-
112
- describe 'with utc time' do
113
- let(:options) do
114
- {
115
- film_name: 'Iron Man 3',
116
- cinema_id: 3,
117
- cinema_name: 'Cineworld Brighton',
118
- starting_at: Time.utc(2013, 9, 12, 11, 0)
119
- }
120
- end
121
-
122
- it 'returns UTC time' do
123
- _(subject).must_be_instance_of Time
124
- _(subject).must_equal Time.utc(2013, 9, 12, 11, 0)
125
- end
126
- end
127
-
128
- describe 'with non-utc time' do
129
- let(:options) do
130
- {
131
- film_name: 'Iron Man 3',
132
- cinema_id: 3,
133
- cinema_name: 'Cineworld Brighton',
134
- starting_at: Time.new(2013, 9, 12, 11, 0)
135
- }
136
- end
137
-
138
- it 'returns UTC time' do
139
- _(subject).must_be_instance_of Time
140
- _(subject).must_equal Time.utc(2013, 9, 12, 10, 0)
141
- _(subject.utc?).must_equal(true)
142
- end
143
- end
144
- end
145
-
146
- describe '#showing_on' do
147
- let(:options) do
148
- {
149
- film_name: 'Iron Man 3',
150
- cinema_id: 3,
151
- cinema_name: 'Cineworld Brighton',
152
- starting_at: Time.utc(2013, 9, 12, 11, 0)
153
- }
154
- end
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 7, performances.count
22
+ end
23
+
24
+ def test_at_accepts_string_id
25
+ stub_showtimes(DATE)
26
+
27
+ assert_equal 7, 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_parses_format_and_film_year
74
+ performance = performances_on_date[5]
75
+
76
+ assert_equal 'Wildwood', performance.film_name
77
+ assert_equal 2026, performance.film_year
78
+ assert_equal %w(4dx), performance.variant
79
+ end
80
+
81
+ def test_new_sets_film_year
82
+ assert_equal 1996, CineworldUk::Performance.new(options(film_year: 1996)).film_year
83
+ end
84
+
85
+ def test_at_keeps_after_midnight_on_next_utc_day
86
+ assert_equal Time.utc(2026, 10, 24, 23, 15), performances_on_date.last.starting_at
87
+ end
88
+
89
+ def test_at_includes_last_requested_day_without_fetching_sites
90
+ stub_showtimes(DATE, empty_showtimes_json)
91
+ stub_showtimes(DATE + 1)
92
+
93
+ performances = CineworldUk::Performance.at(14, from: DATE, to: DATE + 1)
94
+
95
+ assert_equal 7, performances.count
96
+ assert_not_requested :get, "#{BASE_URL}sites"
97
+ end
98
+
99
+ def test_at_defaults_to_fourteen_days
100
+ (DATE..DATE + 13).each { |date| stub_showtimes(date, empty_showtimes_json) }
101
+
102
+ assert_equal [], CineworldUk::Performance.at(14, from: DATE)
103
+ assert_requested :get, %r{showtimes/by-business-date/}, times: 14
104
+ end
105
+
106
+ def test_at_rejects_range_ending_before_start
107
+ assert_raises(ArgumentError) { CineworldUk::Performance.at(14, from: DATE, to: DATE - 1) }
108
+ end
109
+
110
+ def test_new_sets_names
111
+ performance = CineworldUk::Performance.new(options)
112
+
113
+ assert_equal 'Iron Man 3', performance.film_name
114
+ assert_equal 'Cineworld Brighton', performance.cinema_name
115
+ end
116
+
117
+ def test_new_sets_defaults
118
+ performance = CineworldUk::Performance.new(options)
119
+
120
+ assert_nil performance.booking_url
121
+ assert_equal '2d', performance.dimension
122
+ assert_nil performance.festival
123
+ assert_nil performance.language
124
+ refute performance.subtitled?
125
+ assert_equal [], performance.variant
126
+ end
127
+
128
+ def test_dimension
129
+ assert_equal '3d', CineworldUk::Performance.new(options(dimension: '3d')).dimension
130
+ end
131
+
132
+ def test_starting_at_keeps_utc
133
+ assert_equal Time.utc(2013, 9, 12, 11, 0), CineworldUk::Performance.new(options).starting_at
134
+ end
135
+
136
+ def test_starting_at_converts_local_time_to_utc
137
+ starting_at = CineworldUk::Performance.new(
138
+ options(starting_at: Time.new(2013, 9, 12, 11, 0))
139
+ ).starting_at
140
+
141
+ assert_equal Time.utc(2013, 9, 12, 10, 0), starting_at
142
+ assert starting_at.utc?
143
+ end
144
+
145
+ def test_showing_on
146
+ assert_equal Date.new(2013, 9, 12), CineworldUk::Performance.new(options).showing_on
147
+ end
148
+
149
+ def test_variant_is_sorted_and_lower_case
150
+ assert_equal %w(kids), CineworldUk::Performance.new(options(variant: ['Kids'])).variant
151
+ end
152
+
153
+ private
154
+
155
+ def options(overrides = {})
156
+ {
157
+ film_name: 'Iron Man 3',
158
+ cinema_id: 3,
159
+ cinema_name: 'Cineworld Brighton',
160
+ starting_at: Time.utc(2013, 9, 12, 11, 0)
161
+ }.merge(overrides)
162
+ end
163
+
164
+ def performances_on_date
165
+ stub_showtimes(DATE)
166
+ CineworldUk::Performance.at(14, from: DATE, to: DATE)
182
167
  end
183
168
  end
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
- describe CineworldUk do
4
- it 'must be defined' do
5
- _(CineworldUk::VERSION).wont_be_nil
3
+ class CineworldUk::VersionTest < Minitest::Test
4
+ def test_version_is_defined
5
+ refute_nil CineworldUk::VERSION
6
6
  end
7
7
  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