cineworld_uk 2.1.6 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -3
- data/README.md +56 -14
- data/Rakefile +57 -1
- data/cineworld_uk.gemspec +1 -2
- data/lib/cineworld_uk/cinema.rb +113 -182
- data/lib/cineworld_uk/internal/api_response.rb +74 -0
- data/lib/cineworld_uk/internal/parser/api/cinema_address.rb +81 -0
- data/lib/cineworld_uk/internal/parser/api/film.rb +46 -0
- data/lib/cineworld_uk/internal/parser/api/film_lookup.rb +38 -0
- data/lib/cineworld_uk/internal/parser/api/performance.rb +46 -0
- data/lib/cineworld_uk/internal/parser/api/performances_by_day.rb +50 -0
- data/lib/cineworld_uk/internal/title_sanitizer.rb +56 -52
- data/lib/cineworld_uk/performance.rb +78 -0
- data/lib/cineworld_uk/version.rb +2 -2
- data/lib/cineworld_uk.rb +11 -8
- data/test/fixtures/api/cinema-detail-10.json +1 -0
- data/test/fixtures/api/cinema-detail-21.json +1 -0
- data/test/fixtures/api/cinema-detail-3.json +1 -0
- data/test/fixtures/api/cinema-detail-96.json +1 -0
- data/test/fixtures/api/cinema-list.json +1 -0
- data/test/fixtures/api/dates-3.json +1 -0
- data/test/fixtures/api/film-list-comingsoon.json +1 -0
- data/test/fixtures/api/film-list.json +1 -0
- data/test/fixtures/api/performances-tomorrow-3.json +1 -0
- data/test/lib/cineworld_uk/cinema_test.rb +96 -197
- data/test/lib/cineworld_uk/internal/api_response_test.rb +85 -0
- data/test/lib/cineworld_uk/internal/parser/api/cinema_address_test.rb +93 -0
- data/test/lib/cineworld_uk/internal/parser/api/film_lookup_test.rb +30 -0
- data/test/lib/cineworld_uk/internal/parser/api/film_test.rb +169 -0
- data/test/lib/cineworld_uk/internal/parser/api/performance_test.rb +62 -0
- data/test/lib/cineworld_uk/internal/title_sanitizer_test.rb +1 -1
- data/test/lib/cineworld_uk/{screening_test.rb → performance_test.rb} +36 -48
- data/test/support/fixture_reader.rb +44 -0
- metadata +48 -59
- data/lib/cineworld_uk/film.rb +0 -65
- data/lib/cineworld_uk/internal/film_with_screenings_parser.rb +0 -69
- data/lib/cineworld_uk/internal/screening_parser.rb +0 -132
- data/lib/cineworld_uk/internal/website.rb +0 -35
- data/lib/cineworld_uk/internal/whatson_parser.rb +0 -36
- data/lib/cineworld_uk/screening.rb +0 -87
- data/test/fixture_updater.rb +0 -64
- data/test/fixtures/cinemas.html +0 -513
- data/test/fixtures/information/brighton.html +0 -1268
- data/test/fixtures/information/bristol.html +0 -1265
- data/test/fixtures/whatson/brighton/film_first.html +0 -207
- data/test/fixtures/whatson/brighton/film_last.html +0 -62
- data/test/fixtures/whatson/brighton/film_second.html +0 -347
- data/test/fixtures/whatson/brighton.html +0 -7508
- data/test/fixtures/whatson/glasgow-imax-at-gsc/film_first.html +0 -182
- data/test/fixtures/whatson/the-o2-greenwich/film_first.html +0 -167
- data/test/lib/cineworld_uk/film_test.rb +0 -142
- data/test/lib/cineworld_uk/internal/film_with_screenings_parser_test.rb +0 -101
- data/test/lib/cineworld_uk/internal/website_test.rb +0 -57
- data/test/lib/cineworld_uk/internal/whatson_parser_test.rb +0 -58
@@ -1,58 +0,0 @@
|
|
1
|
-
require_relative '../../../test_helper'
|
2
|
-
|
3
|
-
describe CineworldUk::Internal::WhatsonParser do
|
4
|
-
let(:described_class) { CineworldUk::Internal::WhatsonParser }
|
5
|
-
|
6
|
-
let(:website) { Minitest::Mock.new }
|
7
|
-
|
8
|
-
before do
|
9
|
-
WebMock.disable_net_connect!
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#films_with_screenings' do
|
13
|
-
subject { described_class.new(3).films_with_screenings }
|
14
|
-
|
15
|
-
before do
|
16
|
-
website.expect(:whatson, brighton_whatson_html, [3])
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'returns an non-zero array of film screenings html fragments' do
|
20
|
-
CineworldUk::Internal::Website.stub :new, website do
|
21
|
-
subject.must_be_instance_of(Array)
|
22
|
-
subject.size.must_be :>, 0
|
23
|
-
|
24
|
-
subject.each do |film_html|
|
25
|
-
film_html.must_be_instance_of(String)
|
26
|
-
film_html.size.must_be :>, 0
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'returns an array with correct content' do
|
32
|
-
CineworldUk::Internal::Website.stub :new, website do
|
33
|
-
# include primary film
|
34
|
-
subject.first.must_include('class="span4"') # big poster
|
35
|
-
subject.first.must_include('class="span5"') # film info block
|
36
|
-
subject.first.must_include('<h3 class="h1">') # title
|
37
|
-
subject.first.must_include('class="row day"') # showing rows
|
38
|
-
|
39
|
-
subject[1..-1].each do |html|
|
40
|
-
html.must_include('class="span2"') # poster
|
41
|
-
html.must_include('class="span7"') # film info block
|
42
|
-
html.must_include('<h3 class="h1">') # title
|
43
|
-
html.must_include('class="row day"') # showing rows
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def read_file(filepath)
|
52
|
-
File.read(File.expand_path(filepath, __FILE__))
|
53
|
-
end
|
54
|
-
|
55
|
-
def brighton_whatson_html
|
56
|
-
read_file('../../../../fixtures/whatson/brighton.html')
|
57
|
-
end
|
58
|
-
end
|