odeon_uk 3.0.5 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 923b9fdff96d0fa70efea9e1f4e3e6b98ff6e13e
4
- data.tar.gz: 9009c376a212f175d79ee583f99a686983e758e5
3
+ metadata.gz: 8b082f5c0f73fda6b73b03492919f702c184722c
4
+ data.tar.gz: c870a782f33abddea4a316059cda6ff3d20b8534
5
5
  SHA512:
6
- metadata.gz: 87307021efaed1bfc13f4b0cbf3ae0375f1b52d21412953ac64a7a7512e58a108a8206da35f6c983e9d47b45df5a77daba1a62e53a14f0f1400817bc7dfc25e6
7
- data.tar.gz: ff6fcc044f3fe51a54558304bb944a050da392786b6cead54ff9bbf8ab6b35863d9c4845adfe4e4f48053828998d4a7aa78a677c1df4bc8d91a04cf33b996d5b
6
+ metadata.gz: 51cd7609ee9c4a39719830d96e3a6d29ac1263001105e0c7e1aac73f39e65aaeeebf66583a5071e65876470c463826eae07fe34ba2c0ab8d1c7482ac340dc6e2
7
+ data.tar.gz: 6b1a5702be7e67792bf5f3561bfdaab2f3064f43c977dbb9271456324054f799bee201f92621f20e84acadc6558b85238a32ad8c04bd3f08dbbac29a86f37c45
data/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
- ## 3.0.4 - 2015-05-06
1
+ ## 3.0.6 - 2015-07-05
2
+
3
+ ### Fixed
4
+ - Protect HTTP use against 500
5
+
6
+ ## 3.0.5 - 2015-07-04
2
7
 
3
8
  ### Fixed
4
9
  - API use for screenings
@@ -30,6 +30,8 @@ module OdeonUk
30
30
 
31
31
  def get(path)
32
32
  URI("http://www.odeon.co.uk/#{path}").read
33
+ rescue OpenURI::HTTPError
34
+ ''
33
35
  end
34
36
  end
35
37
  end
@@ -1,6 +1,6 @@
1
1
  # Ruby interface for http://www.odeon.co.uk
2
- # @version 3.0.5
2
+ # @version 3.0.6
3
3
  module OdeonUk
4
4
  # Gem version
5
- VERSION = '3.0.5'
5
+ VERSION = '3.0.6'
6
6
  end
@@ -8,30 +8,60 @@ describe OdeonUk::Html::Website do
8
8
  describe '#cinema(id)' do
9
9
  subject { described_class.new.cinema(71) }
10
10
 
11
- before { stub_get('cinemas/odeon/71/', cinema_html(71)) }
11
+ describe 'successful http request' do
12
+ before { stub_get('cinemas/odeon/71/', cinema_html(71)) }
12
13
 
13
- it 'returns a string' do
14
- subject.class.must_equal String
14
+ it 'returns a string' do
15
+ subject.class.must_equal String
16
+ end
17
+ end
18
+
19
+ describe 'unsuccessful http request' do
20
+ before { stub_get_with_500('cinemas/odeon/71/') }
21
+
22
+ it 'returns an empty string' do
23
+ subject.must_equal ''
24
+ end
15
25
  end
16
26
  end
17
27
 
18
28
  describe '#sitemap' do
19
29
  subject { described_class.new.sitemap }
20
30
 
21
- before { stub_get('sitemap/', sitemap_html) }
31
+ describe 'successful http request' do
32
+ before { stub_get('sitemap/', sitemap_html) }
22
33
 
23
- it 'returns a string' do
24
- subject.class.must_equal String
34
+ it 'returns a string' do
35
+ subject.class.must_equal String
36
+ end
37
+ end
38
+
39
+ describe 'unsuccessful http request' do
40
+ before { stub_get_with_500('sitemap/') }
41
+
42
+ it 'returns an empty string' do
43
+ subject.must_equal ''
44
+ end
25
45
  end
26
46
  end
27
47
 
28
48
  describe '#showtimes(id)' do
29
49
  subject { described_class.new.showtimes(71) }
30
50
 
31
- before { stub_get('showtimes/week/71/?siteId=71', showtimes_html(71)) }
51
+ describe 'successful http request' do
52
+ before { stub_get('showtimes/week/71/?siteId=71', showtimes_html(71)) }
53
+
54
+ it 'returns a string' do
55
+ subject.class.must_equal String
56
+ end
57
+ end
58
+
59
+ describe 'unsuccessful http request' do
60
+ before { stub_get_with_500('showtimes/week/71/?siteId=71') }
32
61
 
33
- it 'returns a string' do
34
- subject.class.must_equal String
62
+ it 'returns an empty string' do
63
+ subject.must_equal ''
64
+ end
35
65
  end
36
66
  end
37
67
  end
@@ -17,6 +17,11 @@ module WebsiteFixturesHelper
17
17
  File.read(File.expand_path("../../fixtures/#{filepath}.html", __FILE__))
18
18
  end
19
19
 
20
+ def stub_get_with_500(site_path)
21
+ url = "http://www.odeon.co.uk/#{site_path}"
22
+ stub_request(:get, url).to_return(status: [500, 'Internal Server Error'])
23
+ end
24
+
20
25
  def stub_get(site_path, response_body)
21
26
  url = "http://www.odeon.co.uk/#{site_path}"
22
27
  response = { status: 200, body: response_body, headers: {} }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: odeon_uk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Croll
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-04 00:00:00.000000000 Z
11
+ date: 2015-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake