metasploit-model 0.30.2 → 1.0.0.pre.rails.pre.4.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.
- checksums.yaml +4 -4
- data/.rspec +4 -2
- data/CONTRIBUTING.md +49 -9
- data/Gemfile +8 -3
- data/lib/metasploit/model.rb +5 -0
- data/lib/metasploit/model/engine.rb +1 -1
- data/lib/metasploit/model/version.rb +14 -26
- data/metasploit-model.gemspec +5 -3
- data/spec/app/models/metasploit/model/association/reflection_spec.rb +7 -5
- data/spec/app/models/metasploit/model/search/group/base_spec.rb +4 -2
- data/spec/app/models/metasploit/model/search/group/intersection_spec.rb +4 -2
- data/spec/app/models/metasploit/model/search/group/union_spec.rb +4 -2
- data/spec/app/models/metasploit/model/search/operation/association_spec.rb +9 -7
- data/spec/app/models/metasploit/model/search/operation/base_spec.rb +7 -5
- data/spec/app/models/metasploit/model/search/operation/boolean_spec.rb +11 -14
- data/spec/app/models/metasploit/model/search/operation/date_spec.rb +8 -6
- data/spec/app/models/metasploit/model/search/operation/group/base_spec.rb +14 -12
- data/spec/app/models/metasploit/model/search/operation/group/intersection_spec.rb +4 -2
- data/spec/app/models/metasploit/model/search/operation/group/union_spec.rb +4 -2
- data/spec/app/models/metasploit/model/search/operation/integer_spec.rb +4 -2
- data/spec/app/models/metasploit/model/search/operation/null_spec.rb +6 -4
- data/spec/app/models/metasploit/model/search/operation/set/integer_spec.rb +4 -2
- data/spec/app/models/metasploit/model/search/operation/set/string_spec.rb +4 -2
- data/spec/app/models/metasploit/model/search/operation/set_spec.rb +6 -4
- data/spec/app/models/metasploit/model/search/operation/string_spec.rb +4 -2
- data/spec/app/models/metasploit/model/search/operator/association_spec.rb +8 -6
- data/spec/app/models/metasploit/model/search/operator/attribute_spec.rb +14 -12
- data/spec/app/models/metasploit/model/search/operator/base_spec.rb +5 -3
- data/spec/app/models/metasploit/model/search/operator/delegation_spec.rb +11 -13
- data/spec/app/models/metasploit/model/search/operator/group/base_spec.rb +7 -5
- data/spec/app/models/metasploit/model/search/operator/group/intersection_spec.rb +5 -3
- data/spec/app/models/metasploit/model/search/operator/group/union_spec.rb +5 -3
- data/spec/app/models/metasploit/model/search/operator/null_spec.rb +7 -5
- data/spec/app/models/metasploit/model/search/operator/single_spec.rb +28 -26
- data/spec/app/models/metasploit/model/search/query_spec.rb +50 -48
- data/spec/app/models/metasploit/model/visitation/visitor_spec.rb +9 -7
- data/spec/app/validators/ip_format_validator_spec.rb +9 -7
- data/spec/app/validators/nil_validator_spec.rb +5 -3
- data/spec/app/validators/parameters_validator_spec.rb +29 -29
- data/spec/app/validators/password_is_strong_validator_spec.rb +19 -17
- data/spec/dummy/config/application.rb +3 -1
- data/spec/dummy/config/environments/development.rb +0 -3
- data/spec/lib/metasploit/model/association/error_spec.rb +3 -1
- data/spec/lib/metasploit/model/association_spec.rb +10 -8
- data/spec/lib/metasploit/model/base_spec.rb +5 -3
- data/spec/lib/metasploit/model/engine_spec.rb +11 -48
- data/spec/lib/metasploit/model/file_spec.rb +5 -3
- data/spec/lib/metasploit/model/invalid_spec.rb +9 -7
- data/spec/lib/metasploit/model/login/status_spec.rb +3 -1
- data/spec/lib/metasploit/model/nilify_blanks_spec.rb +13 -11
- data/spec/lib/metasploit/model/realm/key_spec.rb +17 -15
- data/spec/lib/metasploit/model/search/association/tree_spec.rb +5 -3
- data/spec/lib/metasploit/model/search/association_spec.rb +4 -2
- data/spec/lib/metasploit/model/search/attribute_spec.rb +8 -6
- data/spec/lib/metasploit/model/search/operation/value/integer_spec.rb +3 -1
- data/spec/lib/metasploit/model/search/operation/value/string_spec.rb +3 -1
- data/spec/lib/metasploit/model/search/operation_spec.rb +13 -11
- data/spec/lib/metasploit/model/search/operator/help_spec.rb +3 -1
- data/spec/lib/metasploit/model/search/with_spec.rb +9 -7
- data/spec/lib/metasploit/model/search_spec.rb +13 -11
- data/spec/lib/metasploit/model/spec/error_spec.rb +4 -2
- data/spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb +7 -5
- data/spec/lib/metasploit/model/spec/pathname_collision_spec.rb +6 -4
- data/spec/lib/metasploit/model/spec_spec.rb +7 -9
- data/spec/lib/metasploit/model/translation_spec.rb +12 -10
- data/spec/lib/metasploit/model/version_spec.rb +139 -3
- data/spec/lib/metasploit/model/visitation/visit_spec.rb +26 -28
- data/spec/matchers/validate_nilness_of_spec.rb +2 -0
- data/spec/spec_helper.rb +10 -80
- data/spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb +1 -1
- data/spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb +8 -8
- data/spec/support/shared/examples/metasploit/model/search/operation/value/string.rb +5 -5
- data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +16 -18
- data/spec/support/shared/examples/metasploit/model/translation.rb +4 -4
- data/spec/support/shared/examples/search/query.rb +3 -3
- data/spec/support/shared/examples/search_association.rb +2 -2
- data/spec/support/shared/examples/search_attribute.rb +3 -3
- data/spec/support/shared/examples/search_with.rb +3 -3
- metadata +20 -27
- data/CHANGELOG.md +0 -6
- data/RELEASING.md +0 -86
- data/UPGRADING.md +0 -1
- data/spec/lib/metasploit/model_spec.rb +0 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 49d17e528f023038bfa676b470ca076cddbdeea1
|
|
4
|
+
data.tar.gz: 2282f543d74c31809dd7a18d71db49c5183d9eb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 671800659174b03d7e2d3b34ed15b108ea9ef8a2a52a4b6c7fa4d3e6a759b64553ef9ed4a82f3dae3055894544ea8c7c6b35ddbd56698edb708ec9f902259824
|
|
7
|
+
data.tar.gz: c8eb303164a1984ef76df9a9cf6c392e76af10ba256272e1d0586f3b5820b707caab1f8b23dcf3f641aac00fee046d5808df9212445f20547f6d9b35da0acfa8
|
data/.rspec
CHANGED
data/CONTRIBUTING.md
CHANGED
|
@@ -25,18 +25,19 @@ issue tracking software.
|
|
|
25
25
|
|
|
26
26
|
### `PRERELEASE`
|
|
27
27
|
|
|
28
|
-
1. Update `PRERELEASE` to match the `SUMMARY` in the branch name. If you branched from `master`, and [version.rb](lib/metasploit/model/version.rb) does not have `PRERELEASE` defined, then adding the following lines after `PATCH`:
|
|
28
|
+
1. Update `PRERELEASE` to match the `SUMMARY` in the branch name. If you branched from `master`, and [version.rb](lib/metasploit/model/version.rb) does not have `PRERELEASE` defined, then adding the following lines after `PATCH`:
|
|
29
29
|
```
|
|
30
|
-
# The prerelease version, scoped to the {
|
|
30
|
+
# The prerelease version, scoped to the {PATCH} version number.
|
|
31
31
|
PRERELEASE = '<SUMMARY>'
|
|
32
32
|
```
|
|
33
33
|
2. `rake spec`
|
|
34
34
|
3. Verify the specs pass, which indicates that `PRERELEASE` was updated correctly.
|
|
35
35
|
4. Commit the change `git commit -a`
|
|
36
36
|
|
|
37
|
+
|
|
37
38
|
### Your changes
|
|
38
39
|
|
|
39
|
-
Make your changes or however many commits you like,
|
|
40
|
+
Make your changes or however many commits you like, commiting each with `git commit`.
|
|
40
41
|
|
|
41
42
|
### Pre-Pull Request Testing
|
|
42
43
|
|
|
@@ -45,12 +46,12 @@ Make your changes or however many commits you like, committing each with `git co
|
|
|
45
46
|
|
|
46
47
|
### Push
|
|
47
48
|
|
|
48
|
-
Push your branch to your fork on
|
|
49
|
+
Push your branch to your fork on gitub: `git push push TYPE/ISSUE/SUMMARY`
|
|
49
50
|
|
|
50
51
|
### Pull Request
|
|
51
52
|
|
|
52
53
|
* [Create new Pull Request](https://github.com/rapid7/metasploit-model/compare/)
|
|
53
|
-
* Add a Verification Steps
|
|
54
|
+
* Add a Verification Steps comment
|
|
54
55
|
|
|
55
56
|
```
|
|
56
57
|
# Verification Steps
|
|
@@ -61,7 +62,6 @@ Push your branch to your fork on github: `git push TYPE/ISSUE/SUMMARY`
|
|
|
61
62
|
- [ ] `rake spec`
|
|
62
63
|
- [ ] VERIFY no failures
|
|
63
64
|
```
|
|
64
|
-
|
|
65
65
|
You should also include at least one scenario to manually check the changes outside of specs.
|
|
66
66
|
|
|
67
67
|
* Add a Post-merge Steps comment
|
|
@@ -106,7 +106,7 @@ Perform these steps prior to pushing to DESTINATION or the build will be broke o
|
|
|
106
106
|
- [ ] Change `PRERELEASE` from `SOURCE_SUMMARY` to `DESTINATION_SUMMARY` to match the branch (DESTINATION) summary (DESTINATION_SUMMARY)
|
|
107
107
|
|
|
108
108
|
## Gem build
|
|
109
|
-
- [ ] gem build
|
|
109
|
+
- [ ] gem build *.gemspec
|
|
110
110
|
- [ ] VERIFY the prerelease suffix has change on the gem.
|
|
111
111
|
|
|
112
112
|
## RSpec
|
|
@@ -118,5 +118,45 @@ Perform these steps prior to pushing to DESTINATION or the build will be broke o
|
|
|
118
118
|
- [ ] `git push origin DESTINATION`
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
* Add a 'Release Steps' comment
|
|
122
|
+
|
|
123
|
+
The 'Release Steps' are a reminder to the reviewer of the Pull Request of how to release the gem.
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
# Release
|
|
127
|
+
|
|
128
|
+
Complete these steps on DESTINATION
|
|
129
|
+
|
|
130
|
+
## Version
|
|
131
|
+
|
|
132
|
+
### Compatible changes
|
|
133
|
+
|
|
134
|
+
If the change are compatible with the previous branch's API, then increment [`PATCH`](lib/metasploit/model/version.rb).
|
|
135
|
+
|
|
136
|
+
### Incompatible changes
|
|
137
|
+
|
|
138
|
+
If your changes are incompatible with the previous branch's API, then increment
|
|
139
|
+
[`MINOR`](lib/metasploit/model/version.rb) and reset [`PATCH`](lib/metasploit/model/version.rb) to `0`.
|
|
140
|
+
|
|
141
|
+
- [ ] Following the rules for [semantic versioning 2.0](http://semver.org/spec/v2.0.0.html), update
|
|
142
|
+
[`MINOR`](lib/metasploit/model/version.rb) and [`PATCH`](lib/metasploit/model/version.rb) and commit the changes.
|
|
143
|
+
|
|
144
|
+
## JRuby
|
|
145
|
+
- [ ] `rvm use jruby@metasploit-model`
|
|
146
|
+
- [ ] `rm Gemfile.lock`
|
|
147
|
+
- [ ] `bundle install`
|
|
148
|
+
- [ ] `rake release`
|
|
149
|
+
|
|
150
|
+
## MRI Ruby
|
|
151
|
+
- [ ] `rvm use ruby-2.1@metasploit-model`
|
|
152
|
+
- [ ] `rm Gemfile.lock`
|
|
153
|
+
- [ ] `bundle install`
|
|
154
|
+
- [ ] `rake release`
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Downstream dependencies
|
|
158
|
+
|
|
159
|
+
When releasing new versions, the following projects may need to be updated:
|
|
160
|
+
|
|
161
|
+
* [metasploit_data_models](https://github.com/rapid7/metasploit_data_models)
|
|
162
|
+
* [metasploit-credential](https://github.com/rapid7/metasploit-credential)
|
data/Gemfile
CHANGED
|
@@ -16,8 +16,8 @@ group :test do
|
|
|
16
16
|
# rails is not used because activerecord should not be included, but rails would normally coordinate the versions
|
|
17
17
|
# between its dependencies, which is now handled by this constraint.
|
|
18
18
|
rails_version_constraint = [
|
|
19
|
-
'>=
|
|
20
|
-
'< 4.
|
|
19
|
+
'>= 4.0.9',
|
|
20
|
+
'< 4.1.0'
|
|
21
21
|
]
|
|
22
22
|
|
|
23
23
|
# Dummy app uses actionpack for ActionController, but not rails since it doesn't use activerecord.
|
|
@@ -26,7 +26,12 @@ group :test do
|
|
|
26
26
|
gem 'coveralls', require: false
|
|
27
27
|
# Engine tasks are loaded using railtie
|
|
28
28
|
gem 'railties', *rails_version_constraint
|
|
29
|
-
gem 'rspec
|
|
29
|
+
gem 'rspec'
|
|
30
|
+
# need rspec-core >= 2.14.0 because 2.14.0 introduced RSpec::Core::SharedExampleGroup::TopLevel
|
|
31
|
+
gem 'rspec-core', '>= 2.14.0', '< 3.0.0'
|
|
32
|
+
# need rspec-rails >= 2.12.0 as 2.12.0 adds support for redefining named subject in nested context that uses the
|
|
33
|
+
# named subject from the outer context without causing a stack overflow.
|
|
34
|
+
gem 'rspec-rails', '>= 2.12.0'
|
|
30
35
|
# In a full rails project, factory_girl_rails would be in both the :development, and :test group, but since we only
|
|
31
36
|
# want rails in :test, factory_girl_rails must also only be in :test.
|
|
32
37
|
# add matchers from shoulda, such as validates_presence_of, which are useful for testing validations
|
data/lib/metasploit/model.rb
CHANGED
|
@@ -14,7 +14,7 @@ class Metasploit::Model::Engine < Rails::Engine
|
|
|
14
14
|
|
|
15
15
|
# Remove ActiveSupport::Dependencies loading paths to save time during constant resolution and to ensure that
|
|
16
16
|
# metasploit-model is properly declaring all autoloads and not falling back on ActiveSupport::Dependencies
|
|
17
|
-
config.paths.
|
|
17
|
+
config.paths.values.each do |path|
|
|
18
18
|
path.skip_autoload!
|
|
19
19
|
path.skip_autoload_once!
|
|
20
20
|
path.skip_eager_load!
|
|
@@ -2,29 +2,20 @@ module Metasploit
|
|
|
2
2
|
module Model
|
|
3
3
|
# Holds components of {VERSION} as defined by {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0}.
|
|
4
4
|
module Version
|
|
5
|
-
#
|
|
6
|
-
# CONSTANTS
|
|
7
|
-
#
|
|
8
|
-
|
|
9
5
|
# The major version number.
|
|
10
|
-
MAJOR =
|
|
6
|
+
MAJOR = 1
|
|
11
7
|
# The minor version number, scoped to the {MAJOR} version number.
|
|
12
|
-
MINOR =
|
|
13
|
-
# The patch
|
|
14
|
-
PATCH =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# Module Methods
|
|
18
|
-
#
|
|
8
|
+
MINOR = 0
|
|
9
|
+
# The patch number, scoped to the {MINOR} version number.
|
|
10
|
+
PATCH = 0
|
|
11
|
+
# the prerelease identifier
|
|
12
|
+
PRERELEASE = 'rails-4.0'
|
|
19
13
|
|
|
20
|
-
# The full version string, including the {
|
|
21
|
-
# {Metasploit::Model::Version::MINOR}, {Metasploit::Model::Version::PATCH}, and optionally, the
|
|
22
|
-
# `Metasploit::Model::Version::PRERELEASE` in the
|
|
14
|
+
# The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the {PRERELEASE} in the
|
|
23
15
|
# {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
|
|
24
16
|
#
|
|
25
|
-
# @return [String] '{
|
|
26
|
-
#
|
|
27
|
-
# on any branch other than master.
|
|
17
|
+
# @return [String] '{MAJOR}.{MINOR}.{PATCH}' on master. '{MAJOR}.{MINOR}.{PATCH}-{PRERELEASE}' on any branch
|
|
18
|
+
# other than master.
|
|
28
19
|
def self.full
|
|
29
20
|
version = "#{MAJOR}.#{MINOR}.#{PATCH}"
|
|
30
21
|
|
|
@@ -35,23 +26,20 @@ module Metasploit
|
|
|
35
26
|
version
|
|
36
27
|
end
|
|
37
28
|
|
|
38
|
-
# The full gem version string, including the {
|
|
39
|
-
# {Metasploit::Model::Version::MINOR}, {Metasploit::Model::Version::PATCH}, and optionally, the
|
|
40
|
-
# `Metasploit::Model::Version::PRERELEASE` in the
|
|
29
|
+
# The full gem version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the {PRERELEASE} in the
|
|
41
30
|
# {http://guides.rubygems.org/specification-reference/#version RubyGems versioning} format.
|
|
42
31
|
#
|
|
43
|
-
# @return [String] '{
|
|
44
|
-
#
|
|
45
|
-
# on any branch other than master.
|
|
32
|
+
# @return [String] '{MAJOR}.{MINOR}.{PATCH}' on master. '{MAJOR}.{MINOR}.{PATCH}.{PRERELEASE}' on any branch
|
|
33
|
+
# other than master.
|
|
46
34
|
def self.gem
|
|
47
35
|
full.gsub('-', '.pre.')
|
|
48
36
|
end
|
|
49
37
|
end
|
|
50
38
|
|
|
51
|
-
#
|
|
39
|
+
# @see Version.gem
|
|
52
40
|
GEM_VERSION = Version.gem
|
|
53
41
|
|
|
54
|
-
#
|
|
42
|
+
# @see Version.full
|
|
55
43
|
VERSION = Version.full
|
|
56
44
|
end
|
|
57
45
|
end
|
data/metasploit-model.gemspec
CHANGED
|
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
spec.required_ruby_version = '>= 2.1'
|
|
20
20
|
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
|
22
|
-
spec.add_development_dependency 'metasploit-version', '~> 0.1.3'
|
|
23
22
|
spec.add_development_dependency 'metasploit-yard', '~> 1.0'
|
|
24
23
|
spec.add_development_dependency 'rake'
|
|
25
24
|
|
|
@@ -28,8 +27,11 @@ Gem::Specification.new do |spec|
|
|
|
28
27
|
spec.add_development_dependency 'yard', '< 0.8.7.4'
|
|
29
28
|
|
|
30
29
|
# Dependency loading
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
rails_version_constraints = ['>= 4.0.9', '< 4.1.0']
|
|
31
|
+
|
|
32
|
+
spec.add_runtime_dependency 'activesupport', *rails_version_constraints
|
|
33
|
+
|
|
34
|
+
spec.add_runtime_dependency 'railties', *rails_version_constraints
|
|
33
35
|
|
|
34
36
|
if RUBY_PLATFORM =~ /java/
|
|
35
37
|
# markdown formatting for yard
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Metasploit::Model::Association::Reflection do
|
|
2
4
|
context 'validations' do
|
|
3
|
-
it {
|
|
4
|
-
it {
|
|
5
|
-
it {
|
|
5
|
+
it { should validate_presence_of :model }
|
|
6
|
+
it { should validate_presence_of :name }
|
|
7
|
+
it { should validate_presence_of :class_name }
|
|
6
8
|
end
|
|
7
9
|
|
|
8
10
|
context '#klass' do
|
|
@@ -40,7 +42,7 @@ RSpec.describe Metasploit::Model::Association::Reflection, type: :model do
|
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
it 'should return Class with Class#name #class_name' do
|
|
43
|
-
|
|
45
|
+
klass.should == class_name_class
|
|
44
46
|
end
|
|
45
47
|
end
|
|
46
48
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Metasploit::Model::Search::Group::Base do
|
|
4
|
+
it { should ensure_length_of(:children).is_at_least(1) }
|
|
3
5
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Metasploit::Model::Search::Group::Intersection do
|
|
4
|
+
it { should be_a Metasploit::Model::Search::Group::Base }
|
|
3
5
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Metasploit::Model::Search::Group::Union do
|
|
4
|
+
it { should be_a Metasploit::Model::Search::Group::Base }
|
|
3
5
|
end
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Metasploit::Model::Search::Operation::Association do
|
|
2
4
|
subject(:operation) {
|
|
3
5
|
described_class.new(
|
|
4
6
|
source_operation: source_operation
|
|
@@ -33,7 +35,7 @@ RSpec.describe Metasploit::Model::Search::Operation::Association, type: :model d
|
|
|
33
35
|
true
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
it {
|
|
38
|
+
it { should_not include(invalid_error) }
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
context 'without valid' do
|
|
@@ -41,7 +43,7 @@ RSpec.describe Metasploit::Model::Search::Operation::Association, type: :model d
|
|
|
41
43
|
false
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
it {
|
|
46
|
+
it { should include(invalid_error) }
|
|
45
47
|
end
|
|
46
48
|
end
|
|
47
49
|
|
|
@@ -54,12 +56,12 @@ RSpec.describe Metasploit::Model::Search::Operation::Association, type: :model d
|
|
|
54
56
|
nil
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
it {
|
|
58
|
-
it {
|
|
59
|
+
it { should include(blank_error) }
|
|
60
|
+
it { should_not include(invalid_error) }
|
|
59
61
|
end
|
|
60
62
|
end
|
|
61
63
|
end
|
|
62
64
|
|
|
63
|
-
it {
|
|
64
|
-
it {
|
|
65
|
+
it { should_not respond_to :value }
|
|
66
|
+
it { should_not respond_to :value= }
|
|
65
67
|
end
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Metasploit::Model::Search::Operation::Base do
|
|
2
4
|
subject(:operation) do
|
|
3
5
|
described_class.new
|
|
4
6
|
end
|
|
5
7
|
|
|
6
8
|
context 'validations' do
|
|
7
9
|
context 'operator' do
|
|
8
|
-
it {
|
|
10
|
+
it { should validate_presence_of(:operator) }
|
|
9
11
|
|
|
10
12
|
context 'valid' do
|
|
11
13
|
let(:errors) do
|
|
@@ -38,7 +40,7 @@ RSpec.describe Metasploit::Model::Search::Operation::Base, type: :model do
|
|
|
38
40
|
end
|
|
39
41
|
|
|
40
42
|
it 'should not record error on operator' do
|
|
41
|
-
|
|
43
|
+
errors.should_not include(error)
|
|
42
44
|
end
|
|
43
45
|
end
|
|
44
46
|
|
|
@@ -48,7 +50,7 @@ RSpec.describe Metasploit::Model::Search::Operation::Base, type: :model do
|
|
|
48
50
|
end
|
|
49
51
|
|
|
50
52
|
it 'should record error on operator' do
|
|
51
|
-
|
|
53
|
+
errors.should include(error)
|
|
52
54
|
end
|
|
53
55
|
end
|
|
54
56
|
end
|
|
@@ -59,7 +61,7 @@ RSpec.describe Metasploit::Model::Search::Operation::Base, type: :model do
|
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
it 'should not record error on operator' do
|
|
62
|
-
|
|
64
|
+
errors.should_not include(error)
|
|
63
65
|
end
|
|
64
66
|
end
|
|
65
67
|
end
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Metasploit::Model::Search::Operation::Boolean do
|
|
2
4
|
context 'CONSTANTS' do
|
|
3
5
|
context 'FORMATTED_VALUE_TO_VALUE' do
|
|
4
6
|
subject(:formatted_value_to_value) do
|
|
5
7
|
described_class::FORMATTED_VALUE_TO_VALUE
|
|
6
8
|
end
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
it "maps 'true' to true" do
|
|
13
|
-
expect(formatted_value_to_value['true']).to eq(true)
|
|
14
|
-
end
|
|
10
|
+
its(['false']) { should be_false }
|
|
11
|
+
its(['true']) { should be_true }
|
|
15
12
|
end
|
|
16
13
|
end
|
|
17
14
|
|
|
18
15
|
context 'validations' do
|
|
19
|
-
it {
|
|
20
|
-
it {
|
|
21
|
-
it {
|
|
16
|
+
it { should allow_value(false).for(:value) }
|
|
17
|
+
it { should allow_value(true).for(:value) }
|
|
18
|
+
it { should_not allow_value(nil).for(:value) }
|
|
22
19
|
end
|
|
23
20
|
|
|
24
21
|
context '#value' do
|
|
@@ -35,7 +32,7 @@ RSpec.describe Metasploit::Model::Search::Operation::Boolean, type: :model do
|
|
|
35
32
|
'false'
|
|
36
33
|
end
|
|
37
34
|
|
|
38
|
-
it {
|
|
35
|
+
it { should be_false }
|
|
39
36
|
end
|
|
40
37
|
|
|
41
38
|
context "with 'true'" do
|
|
@@ -43,7 +40,7 @@ RSpec.describe Metasploit::Model::Search::Operation::Boolean, type: :model do
|
|
|
43
40
|
'true'
|
|
44
41
|
end
|
|
45
42
|
|
|
46
|
-
it {
|
|
43
|
+
it { should be_true }
|
|
47
44
|
end
|
|
48
45
|
|
|
49
46
|
context 'with other' do
|
|
@@ -52,7 +49,7 @@ RSpec.describe Metasploit::Model::Search::Operation::Boolean, type: :model do
|
|
|
52
49
|
end
|
|
53
50
|
|
|
54
51
|
it 'should return value unparsed' do
|
|
55
|
-
|
|
52
|
+
value.should == formatted_value
|
|
56
53
|
end
|
|
57
54
|
end
|
|
58
55
|
end
|