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.
- checksums.yaml +4 -4
- data/.travis.yml +6 -3
- data/CHANGELOG.md +19 -0
- data/{LICENSE.txt → COMM-LICENSE} +0 -0
- data/LICENSE +617 -0
- data/README.md +5 -4
- data/Rakefile +12 -0
- data/lib/picturehouse_uk.rb +2 -4
- data/lib/picturehouse_uk/cinema.rb +133 -124
- data/lib/picturehouse_uk/internal/parser/address.rb +20 -8
- data/lib/picturehouse_uk/internal/parser/screenings.rb +70 -28
- data/lib/picturehouse_uk/internal/title_sanitizer.rb +61 -65
- data/lib/picturehouse_uk/performance.rb +60 -0
- data/lib/picturehouse_uk/version.rb +2 -2
- data/picturehouse_uk.gemspec +5 -6
- data/rake/fixture_creator.rb +42 -0
- data/test/fixtures/Duke_Of_Yorks/cinema.html +3408 -0
- data/test/fixtures/{info/Duke_Of_Yorks.html → Duke_Of_Yorks/info.html} +192 -185
- data/test/fixtures/Duke_Of_Yorks/whats_on.html +3159 -0
- data/test/fixtures/Dukes_At_Komedia/cinema.html +4764 -0
- data/test/fixtures/{info/Dukes_At_Komedia.html → Dukes_At_Komedia/info.html} +161 -172
- data/test/fixtures/Dukes_At_Komedia/whats_on.html +4429 -0
- data/test/fixtures/National_Media_Museum/cinema.html +9200 -0
- data/test/fixtures/National_Media_Museum/info.html +606 -0
- data/test/fixtures/National_Media_Museum/whats_on.html +8850 -0
- data/test/fixtures/Phoenix_Picturehouse/cinema.html +8274 -0
- data/test/fixtures/{info/Phoenix_Picturehouse.html → Phoenix_Picturehouse/info.html} +165 -176
- data/test/fixtures/Phoenix_Picturehouse/whats_on.html +7986 -0
- data/test/fixtures/home.html +148 -157
- data/test/lib/picturehouse_uk/cinema_test.rb +107 -136
- data/test/lib/picturehouse_uk/internal/parser/{address_parser_test.rb → address_test.rb} +3 -3
- data/test/lib/picturehouse_uk/internal/parser/screenings_test.rb +8 -10
- data/test/lib/picturehouse_uk/internal/website_test.rb +6 -3
- data/test/lib/picturehouse_uk/{screening_test.rb → performance_test.rb} +20 -44
- data/test/live/integration_test.rb +8 -25
- data/test/support/fake_website.rb +24 -0
- data/test/test_helper.rb +12 -2
- metadata +50 -49
- data/.rdoc_options +0 -16
- data/lib/picturehouse_uk/film.rb +0 -59
- data/lib/picturehouse_uk/screening.rb +0 -70
- data/test/fixture_updater.rb +0 -73
- data/test/fixtures/cinema/Duke_Of_Yorks.html +0 -2984
- data/test/fixtures/cinema/Dukes_At_Komedia.html +0 -5518
- data/test/fixtures/cinema/National_Media_Museum.html +0 -10266
- data/test/fixtures/cinema/Phoenix_Picturehouse.html +0 -5202
- data/test/fixtures/whats_on/Duke_Of_Yorks.html +0 -2737
- data/test/fixtures/whats_on/Dukes_At_Komedia.html +0 -5132
- data/test/fixtures/whats_on/National_Media_Museum.html +0 -9690
- data/test/fixtures/whats_on/Phoenix_Picturehouse.html +0 -4916
- data/test/lib/picturehouse_uk/film_test.rb +0 -141
@@ -2,11 +2,10 @@ require_relative '../../test_helper'
|
|
2
2
|
|
3
3
|
describe PicturehouseUk::Cinema do
|
4
4
|
let(:described_class) { PicturehouseUk::Cinema }
|
5
|
-
let(:website) {
|
5
|
+
let(:website) { FakeWebsite.new }
|
6
6
|
|
7
|
-
before
|
8
|
-
|
9
|
-
end
|
7
|
+
before { WebMock.disable_net_connect! }
|
8
|
+
after { WebMock.allow_net_connect! }
|
10
9
|
|
11
10
|
describe '.all' do
|
12
11
|
subject { described_class.all }
|
@@ -22,7 +21,7 @@ describe PicturehouseUk::Cinema do
|
|
22
21
|
|
23
22
|
it 'returns the correctly sized array' do
|
24
23
|
PicturehouseUk::Internal::Website.stub :new, website do
|
25
|
-
subject.size.must_equal
|
24
|
+
subject.size.must_equal 23
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
@@ -34,55 +33,19 @@ describe PicturehouseUk::Cinema do
|
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
|
-
describe '.
|
38
|
-
subject { described_class.
|
39
|
-
|
40
|
-
let(:id) { 'Duke_Of_Yorks' }
|
41
|
-
|
42
|
-
it 'returns a cinema' do
|
43
|
-
PicturehouseUk::Internal::Website.stub :new, website do
|
44
|
-
subject.must_be_instance_of(PicturehouseUk::Cinema)
|
45
|
-
|
46
|
-
subject.id.must_equal id
|
47
|
-
subject.brand.must_equal 'Picturehouse'
|
48
|
-
subject.name.must_equal "Duke of York's Picturehouse"
|
49
|
-
subject.slug.must_equal 'duke-of-yorks-picturehouse'
|
50
|
-
subject.url.must_equal "http://www.picturehouses.com/cinema/#{id}"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe '.new(options)' do
|
56
|
-
let(:options) do
|
57
|
-
{
|
58
|
-
id: 'Dukes_At_Komedia',
|
59
|
-
name: "Duke's At Komedia",
|
60
|
-
url: '/cinema/Dukes_At_Komedia'
|
61
|
-
}
|
62
|
-
end
|
63
|
-
|
64
|
-
subject { described_class.new(options) }
|
36
|
+
describe '.new(id)' do
|
37
|
+
subject { described_class.new('Dukes_At_Komedia') }
|
65
38
|
|
66
39
|
it 'stores id, name, slug and url' do
|
67
|
-
subject.
|
68
|
-
subject.brand.must_equal 'Picturehouse'
|
69
|
-
subject.name.must_equal "Duke's At Komedia"
|
70
|
-
subject.slug.must_equal 'dukes-at-komedia'
|
71
|
-
subject.url.must_equal 'http://www.picturehouses.com/cinema/Dukes_At_Komedia'
|
40
|
+
subject.must_be_instance_of(PicturehouseUk::Cinema)
|
72
41
|
end
|
73
42
|
end
|
74
43
|
|
75
44
|
describe '#adr' do
|
76
|
-
|
77
|
-
{
|
78
|
-
id: 'Phoenix_Picturehouse',
|
79
|
-
name: "Pheonix Picturehouse",
|
80
|
-
url: '/cinema/Phoenix_Picturehouse'
|
81
|
-
}
|
82
|
-
end
|
45
|
+
subject { described_class.new(id).adr }
|
83
46
|
|
84
|
-
describe '
|
85
|
-
|
47
|
+
describe 'no region' do
|
48
|
+
let(:id) { 'Phoenix_Picturehouse' }
|
86
49
|
|
87
50
|
it 'returns address hash' do
|
88
51
|
PicturehouseUk::Internal::Website.stub :new, website do
|
@@ -92,24 +55,14 @@ describe PicturehouseUk::Cinema do
|
|
92
55
|
locality: 'Oxford',
|
93
56
|
region: nil,
|
94
57
|
postal_code: 'OX2 6AE',
|
95
|
-
|
58
|
+
country_name: 'United Kingdom'
|
96
59
|
)
|
97
60
|
end
|
98
61
|
end
|
99
62
|
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe 'integration-y address tests' do
|
103
|
-
let(:options) do
|
104
|
-
{
|
105
|
-
id: 'Dukes_At_Komedia',
|
106
|
-
name: "Duke's At Komedia",
|
107
|
-
url: '/cinema/Dukes_At_Komedia'
|
108
|
-
}
|
109
|
-
end
|
110
63
|
|
111
|
-
describe '
|
112
|
-
|
64
|
+
describe 'with region' do
|
65
|
+
let(:id) { 'Dukes_At_Komedia' }
|
113
66
|
|
114
67
|
it 'returns address hash' do
|
115
68
|
PicturehouseUk::Internal::Website.stub :new, website do
|
@@ -119,134 +72,152 @@ describe PicturehouseUk::Cinema do
|
|
119
72
|
locality: 'Brighton',
|
120
73
|
region: 'East Sussex',
|
121
74
|
postal_code: 'BN1 1UN',
|
122
|
-
|
75
|
+
country_name: 'United Kingdom'
|
123
76
|
)
|
124
77
|
end
|
125
78
|
end
|
126
79
|
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe '#address' do
|
83
|
+
subject { described_class.new(id).address }
|
127
84
|
|
128
|
-
describe '
|
129
|
-
|
85
|
+
describe 'no region' do
|
86
|
+
let(:id) { 'Phoenix_Picturehouse' }
|
130
87
|
|
131
|
-
it 'returns
|
88
|
+
it 'returns address hash' do
|
132
89
|
PicturehouseUk::Internal::Website.stub :new, website do
|
133
|
-
subject.must_equal(
|
90
|
+
subject.must_equal(
|
91
|
+
street_address: '57 Walton Street',
|
92
|
+
extended_address: nil,
|
93
|
+
locality: 'Oxford',
|
94
|
+
region: nil,
|
95
|
+
postal_code: 'OX2 6AE',
|
96
|
+
country_name: 'United Kingdom'
|
97
|
+
)
|
134
98
|
end
|
135
99
|
end
|
136
100
|
end
|
101
|
+
end
|
137
102
|
|
138
|
-
|
139
|
-
|
103
|
+
describe '#brand' do
|
104
|
+
subject { described_class.new(id).brand }
|
140
105
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
106
|
+
let(:id) { 'Dukes_At_Komedia' }
|
107
|
+
|
108
|
+
it 'returns Picturehouse' do
|
109
|
+
PicturehouseUk::Internal::Website.stub :new, website do
|
110
|
+
subject.must_equal('Picturehouse')
|
145
111
|
end
|
146
112
|
end
|
113
|
+
end
|
147
114
|
|
148
|
-
|
149
|
-
|
115
|
+
describe '#country_name' do
|
116
|
+
subject { described_class.new(id).country_name }
|
150
117
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
118
|
+
let(:id) { 'Dukes_At_Komedia' }
|
119
|
+
|
120
|
+
it 'returns country' do
|
121
|
+
PicturehouseUk::Internal::Website.stub :new, website do
|
122
|
+
subject.must_equal('United Kingdom')
|
155
123
|
end
|
156
124
|
end
|
125
|
+
end
|
157
126
|
|
158
|
-
|
159
|
-
|
127
|
+
describe '#extended_address' do
|
128
|
+
subject { described_class.new(id).extended_address }
|
160
129
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
130
|
+
let(:id) { 'Dukes_At_Komedia' }
|
131
|
+
|
132
|
+
it 'returns second line of address' do
|
133
|
+
PicturehouseUk::Internal::Website.stub :new, website do
|
134
|
+
subject.must_equal('')
|
165
135
|
end
|
166
136
|
end
|
137
|
+
end
|
167
138
|
|
168
|
-
|
169
|
-
|
139
|
+
describe '#full_name' do
|
140
|
+
subject { described_class.new(id).full_name }
|
170
141
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
142
|
+
let(:id) { 'Dukes_At_Komedia' }
|
143
|
+
|
144
|
+
it 'returns full name (same as name)' do
|
145
|
+
PicturehouseUk::Internal::Website.stub :new, website do
|
146
|
+
subject.must_equal("Duke's at Komedia")
|
147
|
+
subject.must_equal(described_class.new(id).name)
|
175
148
|
end
|
176
149
|
end
|
177
150
|
end
|
178
151
|
|
179
|
-
describe '#
|
180
|
-
|
181
|
-
{
|
182
|
-
id: 'Dukes_At_Komedia',
|
183
|
-
name: "Duke's At Komedia",
|
184
|
-
url: '/cinema/Dukes_At_Komedia'
|
185
|
-
}
|
186
|
-
end
|
152
|
+
describe '#locality' do
|
153
|
+
subject { described_class.new(id).locality }
|
187
154
|
|
188
|
-
|
155
|
+
let(:id) { 'Dukes_At_Komedia' }
|
189
156
|
|
190
|
-
it '
|
191
|
-
PicturehouseUk::
|
192
|
-
subject.must_equal(
|
157
|
+
it 'returns second line of address' do
|
158
|
+
PicturehouseUk::Internal::Website.stub :new, website do
|
159
|
+
subject.must_equal('Brighton')
|
193
160
|
end
|
194
161
|
end
|
195
162
|
end
|
196
163
|
|
197
|
-
describe '#
|
198
|
-
|
199
|
-
{
|
200
|
-
id: 'Dukes_At_Komedia',
|
201
|
-
name: "Duke's At Komedia",
|
202
|
-
url: '/cinema/Dukes_At_Komedia'
|
203
|
-
}
|
204
|
-
end
|
164
|
+
describe '#name' do
|
165
|
+
subject { described_class.new(id).name }
|
205
166
|
|
206
|
-
|
167
|
+
let(:id) { 'Dukes_At_Komedia' }
|
207
168
|
|
208
|
-
it 'returns
|
209
|
-
|
169
|
+
it 'returns full name (same as name)' do
|
170
|
+
PicturehouseUk::Internal::Website.stub :new, website do
|
171
|
+
subject.must_equal("Duke's at Komedia")
|
172
|
+
end
|
210
173
|
end
|
211
174
|
end
|
212
175
|
|
213
|
-
describe '#
|
214
|
-
|
215
|
-
{
|
216
|
-
id: 'Dukes_At_Komedia',
|
217
|
-
name: "Duke's At Komedia",
|
218
|
-
url: '/cinema/Dukes_At_Komedia'
|
219
|
-
}
|
220
|
-
end
|
176
|
+
describe '#postal_code' do
|
177
|
+
subject { described_class.new(id).postal_code }
|
221
178
|
|
222
|
-
|
179
|
+
let(:id) { 'Dukes_At_Komedia' }
|
223
180
|
|
224
|
-
it '
|
225
|
-
PicturehouseUk::
|
226
|
-
subject.must_equal(
|
181
|
+
it 'returns second line of address' do
|
182
|
+
PicturehouseUk::Internal::Website.stub :new, website do
|
183
|
+
subject.must_equal('BN1 1UN')
|
227
184
|
end
|
228
185
|
end
|
229
186
|
end
|
230
187
|
|
231
|
-
|
188
|
+
describe '#region' do
|
189
|
+
subject { described_class.new(id).region }
|
232
190
|
|
233
|
-
|
234
|
-
def home
|
235
|
-
read_file('../../../fixtures/home.html')
|
236
|
-
end
|
191
|
+
let(:id) { 'Dukes_At_Komedia' }
|
237
192
|
|
238
|
-
|
239
|
-
|
193
|
+
it 'returns second line of address' do
|
194
|
+
PicturehouseUk::Internal::Website.stub :new, website do
|
195
|
+
subject.must_equal('East Sussex')
|
196
|
+
end
|
240
197
|
end
|
198
|
+
end
|
241
199
|
|
242
|
-
|
243
|
-
|
200
|
+
describe '#slug' do
|
201
|
+
subject { described_class.new(id).slug }
|
202
|
+
|
203
|
+
let(:id) { 'Dukes_At_Komedia' }
|
204
|
+
|
205
|
+
it 'returns downcased' do
|
206
|
+
PicturehouseUk::Internal::Website.stub :new, website do
|
207
|
+
subject.must_equal('dukes-at-komedia')
|
208
|
+
end
|
244
209
|
end
|
210
|
+
end
|
211
|
+
|
212
|
+
describe '#street_address' do
|
213
|
+
subject { described_class.new(id).street_address }
|
245
214
|
|
246
|
-
|
215
|
+
let(:id) { 'Dukes_At_Komedia' }
|
247
216
|
|
248
|
-
|
249
|
-
|
217
|
+
it 'returns first line of address' do
|
218
|
+
PicturehouseUk::Internal::Website.stub :new, website do
|
219
|
+
subject.must_equal('44–47 Gardner Street')
|
220
|
+
end
|
250
221
|
end
|
251
222
|
end
|
252
223
|
end
|
@@ -18,7 +18,7 @@ describe PicturehouseUk::Internal::Parser::Address do
|
|
18
18
|
locality: nil,
|
19
19
|
region: nil,
|
20
20
|
postal_code: nil,
|
21
|
-
|
21
|
+
country_name: "United Kingdom")
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -32,7 +32,7 @@ describe PicturehouseUk::Internal::Parser::Address do
|
|
32
32
|
locality: nil,
|
33
33
|
region: nil,
|
34
34
|
postal_code: nil,
|
35
|
-
|
35
|
+
country_name: "United Kingdom")
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -46,7 +46,7 @@ describe PicturehouseUk::Internal::Parser::Address do
|
|
46
46
|
locality: "not an address",
|
47
47
|
region: nil,
|
48
48
|
postal_code: "not an address",
|
49
|
-
|
49
|
+
country_name: "United Kingdom")
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -2,12 +2,10 @@ require_relative '../../../../test_helper'
|
|
2
2
|
|
3
3
|
describe PicturehouseUk::Internal::Parser::Screenings do
|
4
4
|
let(:described_class) { PicturehouseUk::Internal::Parser::Screenings }
|
5
|
-
|
6
5
|
let(:website) { Minitest::Mock.new }
|
7
6
|
|
8
|
-
before
|
9
|
-
|
10
|
-
end
|
7
|
+
before { WebMock.disable_net_connect! }
|
8
|
+
after { WebMock.allow_net_connect! }
|
11
9
|
|
12
10
|
%w(Duke_Of_Yorks Dukes_At_Komedia Phoenix_Picturehouse).each do |cinema|
|
13
11
|
describe "#{cinema}: #to_a" do
|
@@ -22,15 +20,15 @@ describe PicturehouseUk::Internal::Parser::Screenings do
|
|
22
20
|
|
23
21
|
subject.each do |element|
|
24
22
|
element.must_be_instance_of(Hash)
|
25
|
-
element.keys.must_equal([:film_name, :dimension, :variant,
|
23
|
+
element.keys.must_equal([:film_name, :dimension, :variant,
|
24
|
+
:booking_url, :starting_at])
|
26
25
|
element[:film_name].must_be_kind_of(String)
|
27
26
|
element[:dimension].must_match(/\A[23]d\z/)
|
28
27
|
if element[:booking_url]
|
29
|
-
element[:booking_url].must_match(
|
30
|
-
element[:booking_url].must_match(/
|
31
|
-
element[:booking_url].must_match(/visSelectTickets\.aspx\?cinemacode=\d+\&txtSessionId=\d+/)
|
28
|
+
element[:booking_url].must_match(%r{\Ahttps?\://picturehouses.com})
|
29
|
+
element[:booking_url].must_match(%r{/cinema/#{cinema}/film/[-\w]+/tickets/\d+})
|
32
30
|
end
|
33
|
-
element[:
|
31
|
+
element[:starting_at].must_be_kind_of(Time)
|
34
32
|
end
|
35
33
|
|
36
34
|
variants = subject.flat_map { |e| e[:variant] }.uniq
|
@@ -67,6 +65,6 @@ describe PicturehouseUk::Internal::Parser::Screenings do
|
|
67
65
|
end
|
68
66
|
|
69
67
|
def html(cinema)
|
70
|
-
read_file("../../../../../fixtures
|
68
|
+
read_file("../../../../../fixtures/#{cinema}/whats_on.html")
|
71
69
|
end
|
72
70
|
end
|
@@ -3,6 +3,9 @@ require_relative '../../../test_helper'
|
|
3
3
|
describe PicturehouseUk::Internal::Website do
|
4
4
|
let(:described_class) { PicturehouseUk::Internal::Website }
|
5
5
|
|
6
|
+
before { WebMock.disable_net_connect! }
|
7
|
+
after { WebMock.allow_net_connect! }
|
8
|
+
|
6
9
|
describe '#cinema(id)' do
|
7
10
|
subject { described_class.new.cinema('Duke_Of_Yorks') }
|
8
11
|
|
@@ -56,15 +59,15 @@ describe PicturehouseUk::Internal::Website do
|
|
56
59
|
private
|
57
60
|
|
58
61
|
def duke_of_yorks_html
|
59
|
-
read_file('../../../../fixtures/cinema
|
62
|
+
read_file('../../../../fixtures/Duke_Of_Yorks/cinema.html')
|
60
63
|
end
|
61
64
|
|
62
65
|
def duke_of_yorks_contact_us_html
|
63
|
-
read_file('../../../../fixtures/info
|
66
|
+
read_file('../../../../fixtures/Duke_Of_Yorks/info.html')
|
64
67
|
end
|
65
68
|
|
66
69
|
def duke_of_yorks_whats_on_html
|
67
|
-
read_file('../../../../fixtures/whats_on
|
70
|
+
read_file('../../../../fixtures/Duke_Of_Yorks/whats_on.html')
|
68
71
|
end
|
69
72
|
|
70
73
|
def home_html
|
@@ -1,31 +1,33 @@
|
|
1
1
|
require_relative '../../test_helper'
|
2
2
|
|
3
|
-
describe PicturehouseUk::
|
4
|
-
let(:
|
3
|
+
describe PicturehouseUk::Performance do
|
4
|
+
let(:described_class) { PicturehouseUk::Performance }
|
5
|
+
let(:website) { FakeWebsite.new }
|
5
6
|
|
6
7
|
before { WebMock.disable_net_connect! }
|
8
|
+
after { WebMock.allow_net_connect! }
|
7
9
|
|
8
10
|
describe '.at(cinema_id)' do
|
9
|
-
subject {
|
11
|
+
subject { described_class.at('Duke_Of_Yorks') }
|
10
12
|
|
11
13
|
it 'returns an array of screenings' do
|
12
14
|
PicturehouseUk::Internal::Website.stub :new, website do
|
13
15
|
subject.must_be_instance_of(Array)
|
14
16
|
subject.each do |screening|
|
15
|
-
screening.must_be_instance_of(PicturehouseUk::
|
17
|
+
screening.must_be_instance_of(PicturehouseUk::Performance)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
22
|
it 'returns correct number of screenings' do
|
21
23
|
PicturehouseUk::Internal::Website.stub :new, website do
|
22
|
-
subject.count.
|
24
|
+
subject.count.must_be :>, 40
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
26
28
|
it 'has valid screenings' do
|
27
29
|
PicturehouseUk::Internal::Website.stub :new, website do
|
28
|
-
subject.map(&:
|
30
|
+
subject.map(&:starting_at).each do |time|
|
29
31
|
time.wont_equal Time.utc(1970, 1, 1, 0, 0)
|
30
32
|
end
|
31
33
|
end
|
@@ -33,7 +35,7 @@ describe PicturehouseUk::Screening do
|
|
33
35
|
end
|
34
36
|
|
35
37
|
describe '.new' do
|
36
|
-
subject {
|
38
|
+
subject { described_class.new(options) }
|
37
39
|
|
38
40
|
describe 'simple' do
|
39
41
|
let(:options) do
|
@@ -41,7 +43,7 @@ describe PicturehouseUk::Screening do
|
|
41
43
|
film_name: 'Iron Man 3',
|
42
44
|
cinema_id: 3,
|
43
45
|
cinema_name: 'Cineworld Brighton',
|
44
|
-
|
46
|
+
starting_at: Time.utc(2013, 9, 12, 11, 0)
|
45
47
|
}
|
46
48
|
end
|
47
49
|
|
@@ -65,11 +67,11 @@ describe PicturehouseUk::Screening do
|
|
65
67
|
dimension: '3d',
|
66
68
|
cinema_id: 3,
|
67
69
|
cinema_name: 'Cineworld Brighton',
|
68
|
-
|
70
|
+
starting_at: Time.utc(2013, 9, 12, 11, 0)
|
69
71
|
}
|
70
72
|
end
|
71
73
|
|
72
|
-
subject {
|
74
|
+
subject { described_class.new(options).dimension }
|
73
75
|
|
74
76
|
it 'returns 2d or 3d' do
|
75
77
|
subject.must_be_instance_of(String)
|
@@ -77,8 +79,8 @@ describe PicturehouseUk::Screening do
|
|
77
79
|
end
|
78
80
|
end
|
79
81
|
|
80
|
-
describe '#
|
81
|
-
subject {
|
82
|
+
describe '#starting_at' do
|
83
|
+
subject { described_class.new(options).starting_at }
|
82
84
|
|
83
85
|
describe 'with utc time' do
|
84
86
|
let(:options) do
|
@@ -86,7 +88,7 @@ describe PicturehouseUk::Screening do
|
|
86
88
|
film_name: 'Iron Man 3',
|
87
89
|
cinema_id: 3,
|
88
90
|
cinema_name: 'Cineworld Brighton',
|
89
|
-
|
91
|
+
starting_at: Time.utc(2013, 9, 12, 11, 0)
|
90
92
|
}
|
91
93
|
end
|
92
94
|
|
@@ -102,7 +104,7 @@ describe PicturehouseUk::Screening do
|
|
102
104
|
film_name: 'Iron Man 3',
|
103
105
|
cinema_id: 3,
|
104
106
|
cinema_name: 'Cineworld Brighton',
|
105
|
-
|
107
|
+
starting_at: Time.parse('2013-09-12 11:00')
|
106
108
|
}
|
107
109
|
end
|
108
110
|
|
@@ -119,11 +121,11 @@ describe PicturehouseUk::Screening do
|
|
119
121
|
film_name: 'Iron Man 3',
|
120
122
|
cinema_id: 3,
|
121
123
|
cinema_name: 'Cineworld Brighton',
|
122
|
-
|
124
|
+
starting_at: Time.utc(2013, 9, 12, 11, 0)
|
123
125
|
}
|
124
126
|
end
|
125
127
|
|
126
|
-
subject {
|
128
|
+
subject { described_class.new(options).showing_on }
|
127
129
|
|
128
130
|
it 'returns date of showing' do
|
129
131
|
subject.must_be_instance_of(Date)
|
@@ -132,14 +134,14 @@ describe PicturehouseUk::Screening do
|
|
132
134
|
end
|
133
135
|
|
134
136
|
describe '#variant' do
|
135
|
-
subject {
|
137
|
+
subject { described_class.new(options).variant }
|
136
138
|
|
137
139
|
let(:options) do
|
138
140
|
{
|
139
141
|
film_name: 'Iron Man 3',
|
140
142
|
cinema_id: 3,
|
141
143
|
cinema_name: 'Cineworld Brighton',
|
142
|
-
|
144
|
+
starting_at: Time.utc(2013, 9, 12, 11, 0),
|
143
145
|
variant: ['Kids']
|
144
146
|
}
|
145
147
|
end
|
@@ -152,30 +154,4 @@ describe PicturehouseUk::Screening do
|
|
152
154
|
subject.must_equal %w(kids)
|
153
155
|
end
|
154
156
|
end
|
155
|
-
|
156
|
-
private
|
157
|
-
|
158
|
-
class MockWebsite
|
159
|
-
def home
|
160
|
-
read_file('../../../fixtures/home.html')
|
161
|
-
end
|
162
|
-
|
163
|
-
def cinema(filename)
|
164
|
-
read_file("../../../fixtures/cinema/#{filename}.html")
|
165
|
-
end
|
166
|
-
|
167
|
-
def contact_us(filename)
|
168
|
-
read_file("../../../fixtures/contact_us/#{filename}.html")
|
169
|
-
end
|
170
|
-
|
171
|
-
def whats_on(filename)
|
172
|
-
read_file("../../../fixtures/whats_on/#{filename}.html")
|
173
|
-
end
|
174
|
-
|
175
|
-
private
|
176
|
-
|
177
|
-
def read_file(filepath)
|
178
|
-
File.read(File.expand_path(filepath, __FILE__))
|
179
|
-
end
|
180
|
-
end
|
181
157
|
end
|