cineworld_uk 2.1.6 → 3.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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -3
  3. data/README.md +56 -14
  4. data/Rakefile +57 -1
  5. data/cineworld_uk.gemspec +1 -2
  6. data/lib/cineworld_uk/cinema.rb +113 -182
  7. data/lib/cineworld_uk/internal/api_response.rb +74 -0
  8. data/lib/cineworld_uk/internal/parser/api/cinema_address.rb +81 -0
  9. data/lib/cineworld_uk/internal/parser/api/film.rb +46 -0
  10. data/lib/cineworld_uk/internal/parser/api/film_lookup.rb +38 -0
  11. data/lib/cineworld_uk/internal/parser/api/performance.rb +46 -0
  12. data/lib/cineworld_uk/internal/parser/api/performances_by_day.rb +50 -0
  13. data/lib/cineworld_uk/internal/title_sanitizer.rb +56 -52
  14. data/lib/cineworld_uk/performance.rb +78 -0
  15. data/lib/cineworld_uk/version.rb +2 -2
  16. data/lib/cineworld_uk.rb +11 -8
  17. data/test/fixtures/api/cinema-detail-10.json +1 -0
  18. data/test/fixtures/api/cinema-detail-21.json +1 -0
  19. data/test/fixtures/api/cinema-detail-3.json +1 -0
  20. data/test/fixtures/api/cinema-detail-96.json +1 -0
  21. data/test/fixtures/api/cinema-list.json +1 -0
  22. data/test/fixtures/api/dates-3.json +1 -0
  23. data/test/fixtures/api/film-list-comingsoon.json +1 -0
  24. data/test/fixtures/api/film-list.json +1 -0
  25. data/test/fixtures/api/performances-tomorrow-3.json +1 -0
  26. data/test/lib/cineworld_uk/cinema_test.rb +96 -197
  27. data/test/lib/cineworld_uk/internal/api_response_test.rb +85 -0
  28. data/test/lib/cineworld_uk/internal/parser/api/cinema_address_test.rb +93 -0
  29. data/test/lib/cineworld_uk/internal/parser/api/film_lookup_test.rb +30 -0
  30. data/test/lib/cineworld_uk/internal/parser/api/film_test.rb +169 -0
  31. data/test/lib/cineworld_uk/internal/parser/api/performance_test.rb +62 -0
  32. data/test/lib/cineworld_uk/internal/title_sanitizer_test.rb +1 -1
  33. data/test/lib/cineworld_uk/{screening_test.rb → performance_test.rb} +36 -48
  34. data/test/support/fixture_reader.rb +44 -0
  35. metadata +48 -59
  36. data/lib/cineworld_uk/film.rb +0 -65
  37. data/lib/cineworld_uk/internal/film_with_screenings_parser.rb +0 -69
  38. data/lib/cineworld_uk/internal/screening_parser.rb +0 -132
  39. data/lib/cineworld_uk/internal/website.rb +0 -35
  40. data/lib/cineworld_uk/internal/whatson_parser.rb +0 -36
  41. data/lib/cineworld_uk/screening.rb +0 -87
  42. data/test/fixture_updater.rb +0 -64
  43. data/test/fixtures/cinemas.html +0 -513
  44. data/test/fixtures/information/brighton.html +0 -1268
  45. data/test/fixtures/information/bristol.html +0 -1265
  46. data/test/fixtures/whatson/brighton/film_first.html +0 -207
  47. data/test/fixtures/whatson/brighton/film_last.html +0 -62
  48. data/test/fixtures/whatson/brighton/film_second.html +0 -347
  49. data/test/fixtures/whatson/brighton.html +0 -7508
  50. data/test/fixtures/whatson/glasgow-imax-at-gsc/film_first.html +0 -182
  51. data/test/fixtures/whatson/the-o2-greenwich/film_first.html +0 -167
  52. data/test/lib/cineworld_uk/film_test.rb +0 -142
  53. data/test/lib/cineworld_uk/internal/film_with_screenings_parser_test.rb +0 -101
  54. data/test/lib/cineworld_uk/internal/website_test.rb +0 -57
  55. 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