zonebie-info 0.0.9 → 0.0.10

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2M3YWQwNmYzZTVkOTA4ZDkyNDQ4YjJiNjg4OWNiOGVhMDM2OTQxZA==
4
+ MDgyZmNjZWEzN2FkYzVhYzVhZDc1NmExMTYzNWNhOTIzODFhZTEwZg==
5
5
  data.tar.gz: !binary |-
6
- MmRjMzMyMDY4Zjc2MWQzYzQ5Mzg2MWUzNWFhNTkyNWQwOGM2NjRiNw==
6
+ MzQzYTRmOGQ2MTZkNjUwM2YzMDZmMThjMzM3ODU4ODI2NzQ3MzlhZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjlmOWZhOTlkYzYwMTc2MTc2MjYzMzdiZDQ5ZTIzOTY0MGQ4NjMxMDJjOThj
10
- ZDhiNWMxZjI3NGQ2ZmEwNzMxMWUwMTBkMGUzNjc0YzA4MmRjNDgyMDE3NjNj
11
- YmUwNjQwN2ZkNzYwYzFhYjJjOWRjYWM4NmEwMDFjODJkZTEyMGU=
9
+ NjJiNWU4Mzg4ZjZkYTMyNGEyNmJmZDRlMTdiMjIzZjg2NzMwYWUxOGQ0NTU1
10
+ ZWU2MDRkZjQ2N2Y2ZWZjOTg5NTMxOWU3OWNmOWU2NTgzODUyNjJkZThjZjY5
11
+ OWE2ZmQxYmZkMjllOWY3YzJlOWNjZWQ1YjhmZTEzNTczMDViOTY=
12
12
  data.tar.gz: !binary |-
13
- ODA4YThkMmY0NTI5MmU2NTJhZGVmMzUxNjljOTY2ZDg5YTMxODliMTcwZjM0
14
- M2EyYzkyNzFmYzU1ODljNDU3ZWUzMzcwNzAzM2EwYzAwMWNmYTNiNjVhYjRk
15
- MWIwMWNhMjIyZmE5YjhmOGNmYTRmNTI3MDY4NmQ2YjA4OGUwMjk=
13
+ MzhhMjhlY2FmYjRkMDVhMmIyZjgzNjE1MGQ1ZmY5NDY0NTU3YzA4Mjg2NzVj
14
+ MjUyNzA3YTI3NTRhN2MyYWZiMzA3YWU1NWVkYjFlNThmYTliMjY0OThhNWIz
15
+ MDA1NjcyMDkzOGFiYzlhOTQzZGFiNWI3M2E0YTc2N2MyNDBmOGU=
@@ -10,13 +10,17 @@ module Zonebie
10
10
 
11
11
  def load_from_wikipedia(zone)
12
12
  @request = Thread.new do
13
- download_summary(zone)
13
+ begin
14
+ download_summary(zone)
15
+ rescue StandardError
16
+ 'Request to wikipedia failed, please check your network connection and try again later'
17
+ end
14
18
  end
15
19
  end
16
20
 
17
21
  def print_timezone_info
18
22
  if @request.nil?
19
- $stderr.puts '', 'Please set the ZONEBIE_INFO environment variable to load data from Wikipedia'
23
+ $stderr.puts '', 'Please set a timezone before printing the info'
20
24
  else
21
25
  if @request.alive?
22
26
  $stderr.puts '', 'Wikipedia download did not complete in time, please check your network connection and try again later'
@@ -1,5 +1,5 @@
1
1
  module Zonebie
2
2
  module Info
3
- VERSION = '0.0.9'
3
+ VERSION = '0.0.10'
4
4
  end
5
5
  end
@@ -45,7 +45,7 @@ describe Zonebie do
45
45
 
46
46
  context 'when the request is nil' do
47
47
  let(:message) do
48
- 'Please set the ZONEBIE_INFO environment variable to load data from Wikipedia'
48
+ 'Please set a timezone before printing the info'
49
49
  end
50
50
 
51
51
  before do
@@ -85,6 +85,26 @@ describe Zonebie do
85
85
  end
86
86
  end
87
87
 
88
+ context 'when the request fails' do
89
+ before do
90
+ allow(Wikipedia).to receive(:find).and_raise StandardError
91
+ $stdout = out
92
+ Zonebie.set_timezone_with_info
93
+ out.rewind
94
+ end
95
+
96
+ after do
97
+ $stdout = STDOUT
98
+ end
99
+
100
+ it 'prints the info from wikipedia' do
101
+ sleep 0.001 # Allow the thread to complete
102
+ Zonebie.print_timezone_info
103
+ out.rewind
104
+ expect(out.read).to eq "\nRequest to wikipedia failed, please check your network connection and try again later\n"
105
+ end
106
+ end
107
+
88
108
  context 'when the request succeeds' do
89
109
  let!(:t) { Thread.new { 'hello' } }
90
110
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zonebie-info
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Bowden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-21 00:00:00.000000000 Z
11
+ date: 2015-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zonebie