metasploit-model 0.29.0 → 0.29.2
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 +5 -13
- 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 +30 -26
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
Y2FkOWY4ZmFkMTgxNTRkNTM3MGJmZGIxMDlhYmMwMWEwMTU2ZWU0OQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7a9c1a9696d76d878f1d6ca7af8e0679236683af
|
4
|
+
data.tar.gz: 7a4e99f2ef50ac6c24dae62b72c200982d7ead95
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NzI2ZTZlYzU1NzlkYTVhYjY3ZWFkY2JkMjgzNmE1MGMzMzM4OWVhMTZmODdl
|
11
|
-
ZWQ4MjhhNGJmZjliMzlmOWI2Nzg1MzBiNWYyNzQ4YWNkNGI5YzI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MTg0ZDYyMWIxNjZiMmVmM2M1YzQ0M2YyMmM5ZTJkNTIyYmE1MWJhNGQ1YWFi
|
14
|
-
YWM0YmFlOTQ1NzhlOGNmMmJhZmU0YTcxMDlmMmZkMDRiMmRlN2EyMzBhNGY3
|
15
|
-
OTA3YmFmYzRiMTRhMTAwOTYyMDYxZDJmOTc0ZWFiZGY5ZjY4Y2I=
|
6
|
+
metadata.gz: cc2b3e78a52f97152e1cb3d54467c51f9b40bf9e931d6378be548956bb493157d78aa2350790dbad9c480817cbe4919dd64f588105e5809e51ebd1529501d4b5
|
7
|
+
data.tar.gz: 30a4cdb23916edb3b633af299bb8473c7006e9dc38ee52bc1238daa9935eba497e50520a7d20744b6df977a383dc8df13bcfb4ba2df9b1f1eb19f166a696e2a5
|
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,97 +1,97 @@
|
|
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: ruby
|
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
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: yard
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - <
|
45
|
+
- - "<"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.8.7.4
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - <
|
52
|
+
- - "<"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.8.7.4
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: activesupport
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: railties
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - <
|
73
|
+
- - "<"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 4.0.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - <
|
80
|
+
- - "<"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 4.0.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: redcarpet
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: Common code, such as validators and mixins, that are shared between ActiveModels
|
@@ -102,12 +102,12 @@ executables: []
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
-
- .coveralls.yml
|
106
|
-
- .gitignore
|
107
|
-
- .rspec
|
108
|
-
- .simplecov
|
109
|
-
- .travis.yml
|
110
|
-
- .yardopts
|
105
|
+
- ".coveralls.yml"
|
106
|
+
- ".gitignore"
|
107
|
+
- ".rspec"
|
108
|
+
- ".simplecov"
|
109
|
+
- ".travis.yml"
|
110
|
+
- ".yardopts"
|
111
111
|
- CONTRIBUTING.md
|
112
112
|
- Gemfile
|
113
113
|
- LICENSE
|
@@ -285,7 +285,10 @@ files:
|
|
285
285
|
- spec/lib/metasploit/model/translation_spec.rb
|
286
286
|
- spec/lib/metasploit/model/version_spec.rb
|
287
287
|
- spec/lib/metasploit/model/visitation/visit_spec.rb
|
288
|
+
- spec/matchers/validate_nilness_of_spec.rb
|
288
289
|
- spec/spec_helper.rb
|
290
|
+
- spec/support/matchers/allow_attribute.rb
|
291
|
+
- spec/support/matchers/validate_nilness_of.rb
|
289
292
|
- spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb
|
290
293
|
- spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
|
291
294
|
- spec/support/shared/examples/metasploit/model/search/operation/value/string.rb
|
@@ -295,7 +298,6 @@ files:
|
|
295
298
|
- spec/support/shared/examples/search_association.rb
|
296
299
|
- spec/support/shared/examples/search_attribute.rb
|
297
300
|
- spec/support/shared/examples/search_with.rb
|
298
|
-
- spec/support/shared/matchers/allow_attribute.rb
|
299
301
|
homepage:
|
300
302
|
licenses: []
|
301
303
|
metadata: {}
|
@@ -307,17 +309,17 @@ require_paths:
|
|
307
309
|
- lib
|
308
310
|
required_ruby_version: !ruby/object:Gem::Requirement
|
309
311
|
requirements:
|
310
|
-
- -
|
312
|
+
- - ">="
|
311
313
|
- !ruby/object:Gem::Version
|
312
|
-
version: '
|
314
|
+
version: '2.1'
|
313
315
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
314
316
|
requirements:
|
315
|
-
- -
|
317
|
+
- - ">="
|
316
318
|
- !ruby/object:Gem::Version
|
317
319
|
version: '0'
|
318
320
|
requirements: []
|
319
321
|
rubyforge_project:
|
320
|
-
rubygems_version: 2.4.
|
322
|
+
rubygems_version: 2.4.3
|
321
323
|
signing_key:
|
322
324
|
specification_version: 4
|
323
325
|
summary: Metasploit Model Mixins and Validators
|
@@ -414,7 +416,10 @@ test_files:
|
|
414
416
|
- spec/lib/metasploit/model/translation_spec.rb
|
415
417
|
- spec/lib/metasploit/model/version_spec.rb
|
416
418
|
- spec/lib/metasploit/model/visitation/visit_spec.rb
|
419
|
+
- spec/matchers/validate_nilness_of_spec.rb
|
417
420
|
- spec/spec_helper.rb
|
421
|
+
- spec/support/matchers/allow_attribute.rb
|
422
|
+
- spec/support/matchers/validate_nilness_of.rb
|
418
423
|
- spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb
|
419
424
|
- spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb
|
420
425
|
- spec/support/shared/examples/metasploit/model/search/operation/value/string.rb
|
@@ -424,5 +429,4 @@ test_files:
|
|
424
429
|
- spec/support/shared/examples/search_association.rb
|
425
430
|
- spec/support/shared/examples/search_attribute.rb
|
426
431
|
- spec/support/shared/examples/search_with.rb
|
427
|
-
- spec/support/shared/matchers/allow_attribute.rb
|
428
432
|
has_rdoc:
|