picturehouse_uk 3.0.14 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -3
  3. data/CHANGELOG.md +19 -0
  4. data/{LICENSE.txt → COMM-LICENSE} +0 -0
  5. data/LICENSE +617 -0
  6. data/README.md +5 -4
  7. data/Rakefile +12 -0
  8. data/lib/picturehouse_uk.rb +2 -4
  9. data/lib/picturehouse_uk/cinema.rb +133 -124
  10. data/lib/picturehouse_uk/internal/parser/address.rb +20 -8
  11. data/lib/picturehouse_uk/internal/parser/screenings.rb +70 -28
  12. data/lib/picturehouse_uk/internal/title_sanitizer.rb +61 -65
  13. data/lib/picturehouse_uk/performance.rb +60 -0
  14. data/lib/picturehouse_uk/version.rb +2 -2
  15. data/picturehouse_uk.gemspec +5 -6
  16. data/rake/fixture_creator.rb +42 -0
  17. data/test/fixtures/Duke_Of_Yorks/cinema.html +3408 -0
  18. data/test/fixtures/{info/Duke_Of_Yorks.html → Duke_Of_Yorks/info.html} +192 -185
  19. data/test/fixtures/Duke_Of_Yorks/whats_on.html +3159 -0
  20. data/test/fixtures/Dukes_At_Komedia/cinema.html +4764 -0
  21. data/test/fixtures/{info/Dukes_At_Komedia.html → Dukes_At_Komedia/info.html} +161 -172
  22. data/test/fixtures/Dukes_At_Komedia/whats_on.html +4429 -0
  23. data/test/fixtures/National_Media_Museum/cinema.html +9200 -0
  24. data/test/fixtures/National_Media_Museum/info.html +606 -0
  25. data/test/fixtures/National_Media_Museum/whats_on.html +8850 -0
  26. data/test/fixtures/Phoenix_Picturehouse/cinema.html +8274 -0
  27. data/test/fixtures/{info/Phoenix_Picturehouse.html → Phoenix_Picturehouse/info.html} +165 -176
  28. data/test/fixtures/Phoenix_Picturehouse/whats_on.html +7986 -0
  29. data/test/fixtures/home.html +148 -157
  30. data/test/lib/picturehouse_uk/cinema_test.rb +107 -136
  31. data/test/lib/picturehouse_uk/internal/parser/{address_parser_test.rb → address_test.rb} +3 -3
  32. data/test/lib/picturehouse_uk/internal/parser/screenings_test.rb +8 -10
  33. data/test/lib/picturehouse_uk/internal/website_test.rb +6 -3
  34. data/test/lib/picturehouse_uk/{screening_test.rb → performance_test.rb} +20 -44
  35. data/test/live/integration_test.rb +8 -25
  36. data/test/support/fake_website.rb +24 -0
  37. data/test/test_helper.rb +12 -2
  38. metadata +50 -49
  39. data/.rdoc_options +0 -16
  40. data/lib/picturehouse_uk/film.rb +0 -59
  41. data/lib/picturehouse_uk/screening.rb +0 -70
  42. data/test/fixture_updater.rb +0 -73
  43. data/test/fixtures/cinema/Duke_Of_Yorks.html +0 -2984
  44. data/test/fixtures/cinema/Dukes_At_Komedia.html +0 -5518
  45. data/test/fixtures/cinema/National_Media_Museum.html +0 -10266
  46. data/test/fixtures/cinema/Phoenix_Picturehouse.html +0 -5202
  47. data/test/fixtures/whats_on/Duke_Of_Yorks.html +0 -2737
  48. data/test/fixtures/whats_on/Dukes_At_Komedia.html +0 -5132
  49. data/test/fixtures/whats_on/National_Media_Museum.html +0 -9690
  50. data/test/fixtures/whats_on/Phoenix_Picturehouse.html +0 -4916
  51. data/test/lib/picturehouse_uk/film_test.rb +0 -141
@@ -1,141 +0,0 @@
1
- require_relative '../../test_helper'
2
-
3
- describe PicturehouseUk::Film do
4
- let(:described_class) { PicturehouseUk::Film }
5
-
6
- describe '.new(name)' do
7
- it 'stores name' do
8
- film = described_class.new('Iron Man 3')
9
- film.name.must_equal 'Iron Man 3'
10
- end
11
- end
12
-
13
- describe '.at(cinema_id)' do
14
- let(:website) { Minitest::Mock.new }
15
-
16
- subject { described_class.at('Duke_Of_Yorks') }
17
-
18
- before do
19
- website.expect(:whats_on, whats_on_html('Duke_Of_Yorks'), ['Duke_Of_Yorks'])
20
- end
21
-
22
- it 'returns an array of films' do
23
- PicturehouseUk::Internal::Website.stub :new, website do
24
- subject.must_be_instance_of(Array)
25
- subject.each do |film|
26
- film.must_be_instance_of(PicturehouseUk::Film)
27
- end
28
- end
29
- end
30
-
31
- it 'returns a decent number of films' do
32
- PicturehouseUk::Internal::Website.stub :new, website do
33
- subject.count.must_be :>, 5
34
- end
35
- end
36
-
37
- it 'returns uniquely named films' do
38
- PicturehouseUk::Internal::Website.stub :new, website do
39
- subject.each_with_index do |item, index|
40
- subject.each_with_index do |jtem, i|
41
- next if index == i
42
- item.name.wont_equal jtem.name
43
- item.wont_equal jtem
44
- end
45
- end
46
- end
47
- end
48
- end
49
-
50
- describe 'Comparable' do
51
- it 'includes comparable methods' do
52
- film = described_class.new 'AAAA'
53
- film.methods.must_include :<
54
- film.methods.must_include :>
55
- film.methods.must_include :==
56
- film.methods.must_include :<=>
57
- film.methods.must_include :<=
58
- film.methods.must_include :>=
59
- end
60
-
61
- describe 'uniqueness' do
62
- it 'defines #hash' do
63
- film = described_class.new 'AAAA'
64
- film.methods.must_include :hash
65
- end
66
-
67
- describe '#hash' do
68
- it 'returns a hash of the slug' do
69
- film = described_class.new 'AAAA'
70
- film.hash == film.slug.hash
71
- end
72
- end
73
-
74
- it 'defines #eql?(other)' do
75
- film = described_class.new 'AAAA'
76
- film.methods.must_include :eql?
77
- end
78
-
79
- describe 'two identically named films' do
80
- let(:film) { described_class.new 'AAAA' }
81
- let(:otherfilm) { described_class.new 'AAAA' }
82
-
83
- it 'retuns only one' do
84
- result = [film, otherfilm].uniq
85
- result.count.must_equal 1
86
- result.must_equal [ described_class.new('AAAA') ]
87
- end
88
- end
89
- end
90
-
91
- describe '<=> (other)' do
92
- subject { film <=> otherfilm }
93
-
94
- describe 'film less than other' do
95
- let(:film) { described_class.new 'AAAA' }
96
- let(:otherfilm) { described_class.new 'BBBB' }
97
-
98
- it 'retuns -1' do
99
- subject.must_equal -1
100
- end
101
- end
102
-
103
- describe 'film greater than other' do
104
- let(:film) { described_class.new 'CCCC' }
105
- let(:otherfilm) { described_class.new 'BBBB' }
106
-
107
- it 'retuns 1' do
108
- subject.must_equal 1
109
- end
110
- end
111
-
112
- describe 'film same as other (exact name)' do
113
- let(:film) { described_class.new 'AAAA' }
114
- let(:otherfilm) { described_class.new 'AAAA' }
115
-
116
- it 'retuns 0' do
117
- subject.must_equal 0
118
- end
119
- end
120
-
121
- describe 'film same as other (inexact name)' do
122
- let(:film) { described_class.new 'blue jasmine' }
123
- let(:otherfilm) { described_class.new 'Blue Jasmine' }
124
-
125
- it 'retuns 0' do
126
- subject.must_equal 0
127
- end
128
- end
129
- end
130
- end
131
-
132
- private
133
-
134
- def whats_on_html(filename)
135
- read_file("../../../fixtures/whats_on/#{filename}.html")
136
- end
137
-
138
- def read_file(filepath)
139
- File.read(File.expand_path(filepath, __FILE__))
140
- end
141
- end