zonebie-info 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/zonebie/info.rb +6 -2
- data/lib/zonebie/info/version.rb +1 -1
- data/spec/zonebie/info_spec.rb +21 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDgyZmNjZWEzN2FkYzVhYzVhZDc1NmExMTYzNWNhOTIzODFhZTEwZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzQzYTRmOGQ2MTZkNjUwM2YzMDZmMThjMzM3ODU4ODI2NzQ3MzlhZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjJiNWU4Mzg4ZjZkYTMyNGEyNmJmZDRlMTdiMjIzZjg2NzMwYWUxOGQ0NTU1
|
10
|
+
ZWU2MDRkZjQ2N2Y2ZWZjOTg5NTMxOWU3OWNmOWU2NTgzODUyNjJkZThjZjY5
|
11
|
+
OWE2ZmQxYmZkMjllOWY3YzJlOWNjZWQ1YjhmZTEzNTczMDViOTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzhhMjhlY2FmYjRkMDVhMmIyZjgzNjE1MGQ1ZmY5NDY0NTU3YzA4Mjg2NzVj
|
14
|
+
MjUyNzA3YTI3NTRhN2MyYWZiMzA3YWU1NWVkYjFlNThmYTliMjY0OThhNWIz
|
15
|
+
MDA1NjcyMDkzOGFiYzlhOTQzZGFiNWI3M2E0YTc2N2MyNDBmOGU=
|
data/lib/zonebie/info.rb
CHANGED
@@ -10,13 +10,17 @@ module Zonebie
|
|
10
10
|
|
11
11
|
def load_from_wikipedia(zone)
|
12
12
|
@request = Thread.new do
|
13
|
-
|
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
|
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'
|
data/lib/zonebie/info/version.rb
CHANGED
data/spec/zonebie/info_spec.rb
CHANGED
@@ -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
|
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.
|
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-
|
11
|
+
date: 2015-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zonebie
|