metasploit-model 0.29.0-java → 0.29.2-java
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 +4 -4
- data/.simplecov +1 -1
- data/.travis.yml +0 -2
- data/CONTRIBUTING.md +1 -1
- data/lib/metasploit/model/version.rb +2 -2
- data/metasploit-model.gemspec +2 -0
- data/spec/dummy/config/environments/development.rb +2 -2
- data/spec/dummy/config/environments/production.rb +2 -0
- data/spec/dummy/config/environments/test.rb +2 -2
- data/spec/matchers/validate_nilness_of_spec.rb +82 -0
- data/spec/support/{shared/matchers → matchers}/allow_attribute.rb +0 -0
- data/spec/support/matchers/validate_nilness_of.rb +46 -0
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b150c41b2ca68b5d851bf1861493f2b53e5d0d1d
|
4
|
+
data.tar.gz: 66cceb2757470aa2e26efcdb41d8cd0d665212f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a270f0baf6f4763df5ac967078687d648bb4acdb48e03d7bd16c945feadd188d8a682e2ff7fdf6f741a6754dba1450b4429c3c6d16f66abd0f11443678459e3
|
7
|
+
data.tar.gz: 47d3cde65dd04c7569f9783ce0f2ec9cd4c92a8a4e4118195550ca63fb7686a858d8c92342f703a65526eb96d4a2135275520d329ffef36e940a1e2c45677f77
|
data/.simplecov
CHANGED
data/.travis.yml
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -148,7 +148,7 @@ If your changes are incompatible with the previous branch's API, then increment
|
|
148
148
|
- [ ] `rake release`
|
149
149
|
|
150
150
|
## MRI Ruby
|
151
|
-
- [ ] `rvm use ruby-1
|
151
|
+
- [ ] `rvm use ruby-2.1@metasploit-model`
|
152
152
|
- [ ] `rm Gemfile.lock`
|
153
153
|
- [ ] `bundle install`
|
154
154
|
- [ ] `rake release`
|
@@ -6,8 +6,8 @@ module Metasploit
|
|
6
6
|
MAJOR = 0
|
7
7
|
# The minor version number, scoped to the {MAJOR} version number.
|
8
8
|
MINOR = 29
|
9
|
-
# The patch number, scoped to the {MINOR} version
|
10
|
-
PATCH =
|
9
|
+
# The patch number, scoped to the {MAJOR} and {MINOR} version numbers.
|
10
|
+
PATCH = 2
|
11
11
|
|
12
12
|
# The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the {PRERELEASE} in the
|
13
13
|
# {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
|
data/metasploit-model.gemspec
CHANGED
@@ -16,6 +16,8 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
17
|
spec.require_paths = %w{app/models app/validators lib}
|
18
18
|
|
19
|
+
spec.required_ruby_version = '>= 2.1'
|
20
|
+
|
19
21
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
20
22
|
spec.add_development_dependency 'rake'
|
21
23
|
|
@@ -6,8 +6,8 @@ Dummy::Application.configure do
|
|
6
6
|
# since you don't have to restart the web server when you make code changes.
|
7
7
|
config.cache_classes = false
|
8
8
|
|
9
|
-
|
10
|
-
config.
|
9
|
+
|
10
|
+
config.eager_load = false
|
11
11
|
|
12
12
|
# Show full error reports and disable caching
|
13
13
|
config.consider_all_requests_local = true
|
@@ -4,6 +4,8 @@ Dummy::Application.configure do
|
|
4
4
|
# Code is not reloaded between requests
|
5
5
|
config.cache_classes = true
|
6
6
|
|
7
|
+
config.eager_load = true
|
8
|
+
|
7
9
|
# Full error reports are disabled and caching is turned on
|
8
10
|
config.consider_all_requests_local = false
|
9
11
|
config.action_controller.perform_caching = true
|
@@ -7,12 +7,12 @@ Dummy::Application.configure do
|
|
7
7
|
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
|
+
config.eager_load = true
|
11
|
+
|
10
12
|
# Configure static asset server for tests with Cache-Control for performance
|
11
13
|
config.serve_static_assets = true
|
12
14
|
config.static_cache_control = "public, max-age=3600"
|
13
15
|
|
14
|
-
# Log error messages when you accidentally call methods on nil
|
15
|
-
config.whiny_nils = true
|
16
16
|
|
17
17
|
# Show full error reports and disable caching
|
18
18
|
config.consider_all_requests_local = true
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe 'validate_nilness_of' do
|
4
|
+
let(:record) {
|
5
|
+
record_class.new
|
6
|
+
}
|
7
|
+
|
8
|
+
context 'a model with a nil validation' do
|
9
|
+
let(:attribute) {
|
10
|
+
:nil_thing
|
11
|
+
}
|
12
|
+
|
13
|
+
let(:record_class) {
|
14
|
+
# capture attribute for Class.new scope
|
15
|
+
attribute = self.attribute
|
16
|
+
|
17
|
+
Class.new do
|
18
|
+
include ActiveModel::Validations
|
19
|
+
|
20
|
+
#
|
21
|
+
# Attributes
|
22
|
+
#
|
23
|
+
|
24
|
+
attr_accessor attribute
|
25
|
+
|
26
|
+
#
|
27
|
+
# Validations
|
28
|
+
#
|
29
|
+
|
30
|
+
validates attribute,
|
31
|
+
nil: true
|
32
|
+
end
|
33
|
+
}
|
34
|
+
|
35
|
+
it 'accepts' do
|
36
|
+
expect(record).to validate_nilness_of(attribute)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'provides correct error message when negated' do
|
40
|
+
expect {
|
41
|
+
expect(record).not_to validate_nilness_of(attribute)
|
42
|
+
}.to raise_error(
|
43
|
+
RSpec::Expectations::ExpectationNotMetError,
|
44
|
+
"Expected errors not to include 'must be nil' when #{attribute} is set"
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'a model without a nil validation' do
|
50
|
+
let(:attribute) {
|
51
|
+
:non_nil_thing
|
52
|
+
}
|
53
|
+
|
54
|
+
let(:record_class) {
|
55
|
+
# capture attribute for Class.new scope
|
56
|
+
attribute = self.attribute
|
57
|
+
|
58
|
+
Class.new do
|
59
|
+
include ActiveModel::Validations
|
60
|
+
|
61
|
+
#
|
62
|
+
# Attributes
|
63
|
+
#
|
64
|
+
|
65
|
+
attr_accessor attribute
|
66
|
+
end
|
67
|
+
}
|
68
|
+
|
69
|
+
it 'rejects' do
|
70
|
+
expect(record).not_to validate_nilness_of(attribute)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'provides the correct failure message' do
|
74
|
+
expect {
|
75
|
+
expect(record).to validate_nilness_of(attribute)
|
76
|
+
}.to raise_error(
|
77
|
+
RSpec::Expectations::ExpectationNotMetError,
|
78
|
+
"Expected errors to include 'must be nil' when #{attribute} is set to an arbitrary string"
|
79
|
+
)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
RSpec::Matchers.define :validate_nilness_of do |attribute|
|
2
|
+
description do
|
3
|
+
"require nil for #{attribute}"
|
4
|
+
end
|
5
|
+
|
6
|
+
failure_message_method = :failure_message_for_should
|
7
|
+
|
8
|
+
# RSpec compatibility without deprecation warnings
|
9
|
+
if respond_to?(:failure_message)
|
10
|
+
failure_message_method = :failure_message
|
11
|
+
end
|
12
|
+
|
13
|
+
send(failure_message_method) do |instance|
|
14
|
+
"Expected errors to include 'must be nil' when #{attribute} is set to an arbitrary string"
|
15
|
+
end
|
16
|
+
|
17
|
+
failure_message_when_negated_method = :failure_message_for_should_not
|
18
|
+
|
19
|
+
# RSpec compatibility without deprecation warnings
|
20
|
+
if respond_to?(:failure_message_when_negated)
|
21
|
+
failure_message_when_negated_method = :failure_message_when_negated
|
22
|
+
end
|
23
|
+
|
24
|
+
send(failure_message_when_negated_method) do |instance|
|
25
|
+
"Expected errors not to include 'must be nil' when #{attribute} is set"
|
26
|
+
end
|
27
|
+
|
28
|
+
match do |instance|
|
29
|
+
writer = :"#{attribute}="
|
30
|
+
instance.send(writer, nil)
|
31
|
+
instance.valid?
|
32
|
+
allow_nil = instance.errors[attribute].empty?
|
33
|
+
|
34
|
+
empty = ''
|
35
|
+
instance.send(writer, empty)
|
36
|
+
instance.valid?
|
37
|
+
disallow_empty = instance.errors[attribute].include?('must be nil')
|
38
|
+
|
39
|
+
present = 'present'
|
40
|
+
instance.send(writer, present)
|
41
|
+
instance.valid?
|
42
|
+
disallow_present = instance.errors[attribute].include?('must be nil')
|
43
|
+
|
44
|
+
allow_nil && disallow_empty && disallow_present
|
45
|
+
end
|
46
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metasploit-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.29.
|
4
|
+
version: 0.29.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Luke Imhoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02
|
11
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -284,7 +284,10 @@ files:
|
|
284
284
|
- spec/lib/metasploit/model/translation_spec.rb
|
285
285
|
- spec/lib/metasploit/model/version_spec.rb
|
286
286
|
- spec/lib/metasploit/model/visitation/visit_spec.rb
|
287
|
+
- spec/matchers/validate_nilness_of_spec.rb
|
287
288
|
- spec/spec_helper.rb
|
289
|
+
- spec/support/matchers/allow_attribute.rb
|
290
|
+
- spec/support/matchers/validate_nilness_of.rb
|
288
291
|
- spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb
|
289
292
|
- spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
|
290
293
|
- spec/support/shared/examples/metasploit/model/search/operation/value/string.rb
|
@@ -294,7 +297,6 @@ files:
|
|
294
297
|
- spec/support/shared/examples/search_association.rb
|
295
298
|
- spec/support/shared/examples/search_attribute.rb
|
296
299
|
- spec/support/shared/examples/search_with.rb
|
297
|
-
- spec/support/shared/matchers/allow_attribute.rb
|
298
300
|
homepage:
|
299
301
|
licenses: []
|
300
302
|
metadata: {}
|
@@ -308,7 +310,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
308
310
|
requirements:
|
309
311
|
- - '>='
|
310
312
|
- !ruby/object:Gem::Version
|
311
|
-
version: '
|
313
|
+
version: '2.1'
|
312
314
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
313
315
|
requirements:
|
314
316
|
- - '>='
|
@@ -316,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
318
|
version: '0'
|
317
319
|
requirements: []
|
318
320
|
rubyforge_project:
|
319
|
-
rubygems_version: 2.
|
321
|
+
rubygems_version: 2.2.2
|
320
322
|
signing_key:
|
321
323
|
specification_version: 4
|
322
324
|
summary: Metasploit Model Mixins and Validators
|
@@ -413,7 +415,10 @@ test_files:
|
|
413
415
|
- spec/lib/metasploit/model/translation_spec.rb
|
414
416
|
- spec/lib/metasploit/model/version_spec.rb
|
415
417
|
- spec/lib/metasploit/model/visitation/visit_spec.rb
|
418
|
+
- spec/matchers/validate_nilness_of_spec.rb
|
416
419
|
- spec/spec_helper.rb
|
420
|
+
- spec/support/matchers/allow_attribute.rb
|
421
|
+
- spec/support/matchers/validate_nilness_of.rb
|
417
422
|
- spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb
|
418
423
|
- spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
|
419
424
|
- spec/support/shared/examples/metasploit/model/search/operation/value/string.rb
|
@@ -423,5 +428,4 @@ test_files:
|
|
423
428
|
- spec/support/shared/examples/search_association.rb
|
424
429
|
- spec/support/shared/examples/search_attribute.rb
|
425
430
|
- spec/support/shared/examples/search_with.rb
|
426
|
-
- spec/support/shared/matchers/allow_attribute.rb
|
427
431
|
has_rdoc:
|