File tree 4 files changed +60
-4
lines changed 4 files changed +60
-4
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,7 @@ gem 'rb-inotify', :require => false
13
13
gem 'rb-fsevent' , :require => false
14
14
gem 'rb-fchange' , :require => false
15
15
gem 'nanoc-cachebuster'
16
+
17
+ group :test do
18
+ gem 'rspec'
19
+ end
Original file line number Diff line number Diff line change 10
10
colored (1.2 )
11
11
cri (2.6.1 )
12
12
colored (~> 1.2 )
13
+ diff-lcs (1.2.5 )
13
14
em-websocket (0.5.1 )
14
15
eventmachine (>= 0.12.9 )
15
16
http_parser.rb (~> 0.6.0 )
61
62
rb-inotify (0.9.5 )
62
63
ffi (>= 0.5.0 )
63
64
redcarpet (3.2.0 )
65
+ rspec (3.5.0 )
66
+ rspec-core (~> 3.5.0 )
67
+ rspec-expectations (~> 3.5.0 )
68
+ rspec-mocks (~> 3.5.0 )
69
+ rspec-core (3.5.4 )
70
+ rspec-support (~> 3.5.0 )
71
+ rspec-expectations (3.5.0 )
72
+ diff-lcs (>= 1.2.0 , < 2.0 )
73
+ rspec-support (~> 3.5.0 )
74
+ rspec-mocks (3.5.0 )
75
+ diff-lcs (>= 1.2.0 , < 2.0 )
76
+ rspec-support (~> 3.5.0 )
77
+ rspec-support (3.5.0 )
64
78
slop (3.6.0 )
65
79
thor (0.19.1 )
66
80
timers (4.0.1 )
@@ -84,3 +98,7 @@ DEPENDENCIES
84
98
rb-fsevent
85
99
rb-inotify
86
100
redcarpet
101
+ rspec
102
+
103
+ BUNDLED WITH
104
+ 1.11.2
Original file line number Diff line number Diff line change @@ -100,19 +100,23 @@ def kind
100
100
'Binary'
101
101
end
102
102
103
- # TODO(ts): validate
104
103
def os
105
- name . split ( '.' ) [ 3 ] . split ( '-' ) . first
104
+ base_name . split ( '.' ) . last . split ( '-' ) . first
106
105
end
107
106
108
- # TODO(ts): validate
109
107
def arch
110
- name . split ( '.' ) [ 3 ] . split ( '-' ) . last
108
+ base_name . split ( '.' ) . last . split ( '-' ) . last
111
109
end
112
110
113
111
def size
114
112
@data [ 'size' ]
115
113
end
114
+
115
+ private
116
+
117
+ def base_name
118
+ name . chomp ( '.tar.gz' ) . chomp ( '.zip' )
119
+ end
116
120
end
117
121
118
122
module Helper
Original file line number Diff line number Diff line change
1
+ require 'rspec'
2
+ require 'helpers/download'
3
+
4
+ describe Downloads ::Asset do
5
+ let ( :asset ) do
6
+ Downloads ::Asset . new ( {
7
+ 'name' => ' prometheus-1.2.0.freebsd-armv5.tar.gz' ,
8
+ } )
9
+ end
10
+
11
+ let ( :beta ) do
12
+ Downloads ::Asset . new ( {
13
+ 'name' => 'alertmanager-0.5.0-beta.0.darwin-amd64.tar.gz' ,
14
+ } )
15
+ end
16
+
17
+ describe '#os' do
18
+ it 'extracts the operating system name' do
19
+ expect ( asset . os ) . to eql ( 'freebsd' )
20
+ expect ( beta . os ) . to eql ( 'darwin' )
21
+ end
22
+ end
23
+
24
+ describe '#arch' do
25
+ it 'extracts the architecture' do
26
+ expect ( asset . arch ) . to eql ( 'armv5' )
27
+ expect ( beta . arch ) . to eql ( 'amd64' )
28
+ end
29
+ end
30
+ end
You can’t perform that action at this time.
0 commit comments