gems-status 1.65.0 → 1.66.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.65.0
1
+ 1.66.0
@@ -48,7 +48,7 @@ module GemsStatus
48
48
  private
49
49
 
50
50
  def match_name(str, name)
51
- str =~ /[gem|ruby].*\b#{name}\b/ || str =~ /#{name}\b.*[gem|ruby].*\b/
51
+ str =~ /(gem|ruby).*\b#{name}\b/ || str =~ /\b#{name}\b.*(gem|ruby).*/
52
52
  end
53
53
 
54
54
  def message(gem)
@@ -48,9 +48,22 @@ module GemsStatus
48
48
  def test_match_name
49
49
  ch = NotASecurityAlertChecker.new([])
50
50
  assert ch.match_name("rubygem mail", "mail")
51
+ assert ch.match_name("mail rubygem", "mail")
51
52
  assert !ch.match_name("mail","mail")
52
- assert ch.match_name("ruby mail", "mail")
53
+ assert ch.match_name("gem mail", "mail")
54
+ assert ch.match_name("gem mail something", "mail")
55
+ assert ch.match_name("ruby something mail", "mail")
56
+ assert ch.match_name("ruby something mail something", "mail")
57
+ assert ch.match_name("something ruby something mail", "mail")
53
58
  assert ch.match_name("mail gem", "mail")
59
+ assert ch.match_name("mail something gem", "mail")
60
+ assert ch.match_name("mail gem something", "mail")
61
+ assert ch.match_name("mail ruby", "mail")
62
+ assert ch.match_name("something mail ruby", "mail")
63
+ assert ch.match_name("something mail ruby something", "mail")
64
+ assert ch.match_name("ruby something mail", "mail")
65
+ assert !ch.match_name("ruby somethingmail", "mail")
66
+ assert !ch.match_name("somethingmail ruby", "mail")
54
67
  end
55
68
 
56
69
  def test_key_for_emails
@@ -75,7 +88,7 @@ module GemsStatus
75
88
  assert_equal 1, ch.security_messages.length
76
89
  end
77
90
 
78
- def test_look_in_emails_for_other_mail
91
+ def test_look_in_emails_for_gem_name
79
92
  mail = MockEmail.new
80
93
  def mail.subject
81
94
  "gem rails"
@@ -95,6 +108,106 @@ module GemsStatus
95
108
  assert_equal 1, ch.security_messages.length
96
109
  end
97
110
 
111
+ def test_look_in_emails_for_invalid_gem_name
112
+ mail = MockEmail.new
113
+ def mail.subject
114
+ "rails issue"
115
+ end
116
+ ch = NotASecurityAlertChecker.new([])
117
+ ch.emails = {
118
+ "other" => [mail]
119
+ }
120
+ gem = MockGem.new
121
+ def gem.name
122
+ "rails"
123
+ end
124
+ assert_equal Hash, ch.security_messages.class
125
+ assert_equal 0, ch.security_messages.length
126
+ ch.look_in_emails(gem)
127
+ assert_equal Hash, ch.security_messages.class
128
+ assert_equal 0, ch.security_messages.length
129
+ end
130
+
131
+ def test_look_in_emails_for_other_gem
132
+ mail = MockEmail.new
133
+ def mail.subject
134
+ "gem rails"
135
+ end
136
+ ch = NotASecurityAlertChecker.new([])
137
+ ch.emails = {
138
+ "other" => [mail]
139
+ }
140
+ gem = MockGem.new
141
+ def gem.name
142
+ "other"
143
+ end
144
+ assert_equal Hash, ch.security_messages.class
145
+ assert_equal 0, ch.security_messages.length
146
+ ch.look_in_emails(gem)
147
+ assert_equal Hash, ch.security_messages.class
148
+ assert_equal 0, ch.security_messages.length
149
+ end
150
+
151
+ def test_look_in_emails_for_ruby_and_gem_name
152
+ mail = MockEmail.new
153
+ def mail.subject
154
+ "ruby blablabla rails"
155
+ end
156
+ ch = NotASecurityAlertChecker.new([])
157
+ ch.emails = {
158
+ "other" => [mail]
159
+ }
160
+ gem = MockGem.new
161
+ def gem.name
162
+ "rails"
163
+ end
164
+ assert_equal Hash, ch.security_messages.class
165
+ assert_equal 0, ch.security_messages.length
166
+ ch.look_in_emails(gem)
167
+ assert_equal Hash, ch.security_messages.class
168
+ assert_equal 1, ch.security_messages.length
169
+ end
170
+
171
+ def test_look_in_emails_for_gem_name_in_a_word
172
+ mail = MockEmail.new
173
+ def mail.subject
174
+ "gem something_rails"
175
+ end
176
+ ch = NotASecurityAlertChecker.new([])
177
+ ch.emails = {
178
+ "other" => [mail]
179
+ }
180
+ gem = MockGem.new
181
+ def gem.name
182
+ "rails"
183
+ end
184
+ assert_equal Hash, ch.security_messages.class
185
+ assert_equal 0, ch.security_messages.length
186
+ ch.look_in_emails(gem)
187
+ assert_equal Hash, ch.security_messages.class
188
+ assert_equal 0, ch.security_messages.length
189
+ end
190
+
191
+ def test_look_in_emails_for_gem_name_in_a_word_2
192
+ mail = MockEmail.new
193
+ def mail.subject
194
+ "gem rails_something"
195
+ end
196
+ ch = NotASecurityAlertChecker.new([])
197
+ ch.emails = {
198
+ "other" => [mail]
199
+ }
200
+ gem = MockGem.new
201
+ def gem.name
202
+ "rails"
203
+ end
204
+ assert_equal Hash, ch.security_messages.class
205
+ assert_equal 0, ch.security_messages.length
206
+ ch.look_in_emails(gem)
207
+ assert_equal Hash, ch.security_messages.class
208
+ assert_equal 0, ch.security_messages.length
209
+ end
210
+
98
211
  def test_gem_uri_with_project_uri
99
212
  ch = NotASecurityAlertChecker.new([])
100
213
 
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: 1.65.0
4
+ version: 1.66.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-19 00:00:00.000000000 Z
12
+ date: 2013-07-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-simple
@@ -171,6 +171,22 @@ dependencies:
171
171
  - - ! '>='
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: rspec
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
174
190
  description: gem-status compares rubygems information from different sources as for
175
191
  reporting which gems are outdated. Sources can be opensuse build service, rubygems.org
176
192
  or a gemfile.lock. Data compared is version and md5sum
@@ -235,7 +251,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
235
251
  version: '0'
236
252
  segments:
237
253
  - 0
238
- hash: -30078519537723814
254
+ hash: 2031904970203107107
239
255
  required_rubygems_version: !ruby/object:Gem::Requirement
240
256
  none: false
241
257
  requirements:
@@ -244,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
260
  version: '0'
245
261
  segments:
246
262
  - 0
247
- hash: -30078519537723814
263
+ hash: 2031904970203107107
248
264
  requirements: []
249
265
  rubyforge_project:
250
266
  rubygems_version: 1.8.25