gems-status 0.65.0 → 1.65.0
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.
- data/VERSION +1 -1
- data/test/test-not_a_security_alert_checker.rb +62 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
1.65.0
|
@@ -4,6 +4,11 @@ require 'test/unit'
|
|
4
4
|
require 'gems-status'
|
5
5
|
|
6
6
|
module GemsStatus
|
7
|
+
class MockSecurityAlert
|
8
|
+
def desc
|
9
|
+
"description"
|
10
|
+
end
|
11
|
+
end
|
7
12
|
class NotASecurityAlertChecker
|
8
13
|
attr_reader :security_messages, :fixed
|
9
14
|
attr_accessor :emails
|
@@ -11,7 +16,8 @@ module GemsStatus
|
|
11
16
|
@security_messages = {}
|
12
17
|
@fixed = {}
|
13
18
|
end
|
14
|
-
public
|
19
|
+
#make this methods public in order to test them
|
20
|
+
public :match_name, :key_for_emails, :look_in_emails, :gem_uri, :filter_security_messages_already_fixed, :message
|
15
21
|
end
|
16
22
|
class MockGem
|
17
23
|
def name
|
@@ -23,6 +29,12 @@ module GemsStatus
|
|
23
29
|
def date
|
24
30
|
Date.new(2012, 12, 12)
|
25
31
|
end
|
32
|
+
def gems_url
|
33
|
+
"http://rubygems.org/gems"
|
34
|
+
end
|
35
|
+
def version
|
36
|
+
"1.2.3"
|
37
|
+
end
|
26
38
|
end
|
27
39
|
class MockEmail
|
28
40
|
def uid
|
@@ -154,5 +166,54 @@ module GemsStatus
|
|
154
166
|
assert_equal 0, ch.security_messages.length
|
155
167
|
end
|
156
168
|
|
169
|
+
def test_check
|
170
|
+
ch = NotASecurityAlertChecker.new([])
|
171
|
+
gem = MockGem.new
|
172
|
+
def ch.look_in_scm(gem)
|
173
|
+
end
|
174
|
+
def ch.look_in_emails(gem)
|
175
|
+
end
|
176
|
+
def ch.filter_security_messages_already_fixed(version, date)
|
177
|
+
end
|
178
|
+
def ch.send_emails(gem)
|
179
|
+
end
|
180
|
+
assert ch.check?(gem)
|
181
|
+
def ch.look_in_scm(gem)
|
182
|
+
@security_messages[gem] = ""
|
183
|
+
end
|
184
|
+
assert !ch.check?(gem)
|
185
|
+
end
|
186
|
+
|
187
|
+
def test_message
|
188
|
+
ch = NotASecurityAlertChecker.new([])
|
189
|
+
gem = MockGem.new
|
190
|
+
result = ch.message(gem)
|
191
|
+
assert result.split("\n")[0].include?(gem.name)
|
192
|
+
assert result.split("\n")[0].include?(gem.version)
|
193
|
+
assert result.split("\n")[0].include?(gem.origin)
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_description
|
197
|
+
ch = NotASecurityAlertChecker.new([])
|
198
|
+
gem = MockGem.new
|
199
|
+
def ch.look_in_scm(gem)
|
200
|
+
@security_messages[gem] = MockSecurityAlert.new
|
201
|
+
end
|
202
|
+
def ch.look_in_emails(gem)
|
203
|
+
end
|
204
|
+
def ch.filter_security_messages_already_fixed(version, date)
|
205
|
+
end
|
206
|
+
def ch.send_emails(gem)
|
207
|
+
end
|
208
|
+
result = ch.description
|
209
|
+
assert result == nil
|
210
|
+
result = ch.check?(gem)
|
211
|
+
result = ch.description
|
212
|
+
assert result.split("\n")[0].include?(gem.name)
|
213
|
+
assert result.split("\n")[0].include?(gem.version)
|
214
|
+
assert result.split("\n")[0].include?(gem.origin)
|
215
|
+
|
216
|
+
end
|
217
|
+
|
157
218
|
end
|
158
219
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gems-status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.65.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -235,7 +235,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
235
235
|
version: '0'
|
236
236
|
segments:
|
237
237
|
- 0
|
238
|
-
hash:
|
238
|
+
hash: -30078519537723814
|
239
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
240
|
none: false
|
241
241
|
requirements:
|
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
244
|
version: '0'
|
245
245
|
segments:
|
246
246
|
- 0
|
247
|
-
hash:
|
247
|
+
hash: -30078519537723814
|
248
248
|
requirements: []
|
249
249
|
rubyforge_project:
|
250
250
|
rubygems_version: 1.8.25
|