metasploit-model 0.30.0-java → 0.30.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -4
  3. data/Gemfile +1 -6
  4. data/lib/metasploit/model/version.rb +1 -1
  5. data/spec/app/models/metasploit/model/association/reflection_spec.rb +5 -7
  6. data/spec/app/models/metasploit/model/search/group/base_spec.rb +2 -4
  7. data/spec/app/models/metasploit/model/search/group/intersection_spec.rb +2 -4
  8. data/spec/app/models/metasploit/model/search/group/union_spec.rb +2 -4
  9. data/spec/app/models/metasploit/model/search/operation/association_spec.rb +7 -9
  10. data/spec/app/models/metasploit/model/search/operation/base_spec.rb +5 -7
  11. data/spec/app/models/metasploit/model/search/operation/boolean_spec.rb +14 -11
  12. data/spec/app/models/metasploit/model/search/operation/date_spec.rb +6 -8
  13. data/spec/app/models/metasploit/model/search/operation/group/base_spec.rb +12 -14
  14. data/spec/app/models/metasploit/model/search/operation/group/intersection_spec.rb +2 -4
  15. data/spec/app/models/metasploit/model/search/operation/group/union_spec.rb +2 -4
  16. data/spec/app/models/metasploit/model/search/operation/integer_spec.rb +2 -4
  17. data/spec/app/models/metasploit/model/search/operation/null_spec.rb +4 -6
  18. data/spec/app/models/metasploit/model/search/operation/set/integer_spec.rb +2 -4
  19. data/spec/app/models/metasploit/model/search/operation/set/string_spec.rb +2 -4
  20. data/spec/app/models/metasploit/model/search/operation/set_spec.rb +4 -6
  21. data/spec/app/models/metasploit/model/search/operation/string_spec.rb +2 -4
  22. data/spec/app/models/metasploit/model/search/operator/association_spec.rb +6 -8
  23. data/spec/app/models/metasploit/model/search/operator/attribute_spec.rb +12 -14
  24. data/spec/app/models/metasploit/model/search/operator/base_spec.rb +3 -5
  25. data/spec/app/models/metasploit/model/search/operator/delegation_spec.rb +13 -11
  26. data/spec/app/models/metasploit/model/search/operator/group/base_spec.rb +5 -7
  27. data/spec/app/models/metasploit/model/search/operator/group/intersection_spec.rb +3 -5
  28. data/spec/app/models/metasploit/model/search/operator/group/union_spec.rb +3 -5
  29. data/spec/app/models/metasploit/model/search/operator/null_spec.rb +5 -7
  30. data/spec/app/models/metasploit/model/search/operator/single_spec.rb +26 -28
  31. data/spec/app/models/metasploit/model/search/query_spec.rb +48 -50
  32. data/spec/app/models/metasploit/model/visitation/visitor_spec.rb +7 -9
  33. data/spec/app/validators/ip_format_validator_spec.rb +7 -9
  34. data/spec/app/validators/nil_validator_spec.rb +3 -5
  35. data/spec/app/validators/parameters_validator_spec.rb +29 -29
  36. data/spec/app/validators/password_is_strong_validator_spec.rb +17 -19
  37. data/spec/lib/metasploit/model/association/error_spec.rb +1 -3
  38. data/spec/lib/metasploit/model/association_spec.rb +8 -10
  39. data/spec/lib/metasploit/model/base_spec.rb +3 -5
  40. data/spec/lib/metasploit/model/engine_spec.rb +48 -11
  41. data/spec/lib/metasploit/model/file_spec.rb +3 -5
  42. data/spec/lib/metasploit/model/invalid_spec.rb +7 -9
  43. data/spec/lib/metasploit/model/login/status_spec.rb +1 -3
  44. data/spec/lib/metasploit/model/nilify_blanks_spec.rb +11 -13
  45. data/spec/lib/metasploit/model/realm/key_spec.rb +15 -17
  46. data/spec/lib/metasploit/model/search/association/tree_spec.rb +3 -5
  47. data/spec/lib/metasploit/model/search/association_spec.rb +2 -4
  48. data/spec/lib/metasploit/model/search/attribute_spec.rb +6 -8
  49. data/spec/lib/metasploit/model/search/operation/value/integer_spec.rb +1 -3
  50. data/spec/lib/metasploit/model/search/operation/value/string_spec.rb +1 -3
  51. data/spec/lib/metasploit/model/search/operation_spec.rb +11 -13
  52. data/spec/lib/metasploit/model/search/operator/help_spec.rb +1 -3
  53. data/spec/lib/metasploit/model/search/with_spec.rb +7 -9
  54. data/spec/lib/metasploit/model/search_spec.rb +11 -13
  55. data/spec/lib/metasploit/model/spec/error_spec.rb +2 -4
  56. data/spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb +5 -7
  57. data/spec/lib/metasploit/model/spec/pathname_collision_spec.rb +4 -6
  58. data/spec/lib/metasploit/model/spec_spec.rb +9 -7
  59. data/spec/lib/metasploit/model/translation_spec.rb +10 -12
  60. data/spec/lib/metasploit/model/version_spec.rb +3 -5
  61. data/spec/lib/metasploit/model/visitation/visit_spec.rb +28 -26
  62. data/spec/matchers/validate_nilness_of_spec.rb +0 -2
  63. data/spec/spec_helper.rb +69 -7
  64. data/spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb +1 -1
  65. data/spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb +8 -8
  66. data/spec/support/shared/examples/metasploit/model/search/operation/value/string.rb +5 -5
  67. data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +18 -16
  68. data/spec/support/shared/examples/metasploit/model/translation.rb +4 -4
  69. data/spec/support/shared/examples/search/query.rb +3 -3
  70. data/spec/support/shared/examples/search_association.rb +2 -2
  71. data/spec/support/shared/examples/search_attribute.rb +3 -3
  72. data/spec/support/shared/examples/search_with.rb +3 -3
  73. metadata +2 -2
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  RSpec.describe 'validate_nilness_of' do
4
2
  let(:record) {
5
3
  record_class.new
@@ -14,10 +14,6 @@ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
14
14
 
15
15
  require File.expand_path('../dummy/config/environment.rb', __FILE__)
16
16
  require 'rspec/rails'
17
- require 'rspec/autorun'
18
-
19
- # full backtrace in logs so its easier to trace errors
20
- Rails.backtrace_cleaner.remove_silencers!
21
17
 
22
18
  spec_pathname = Metasploit::Model::Engine.root.join('spec')
23
19
 
@@ -25,7 +21,76 @@ Dir[spec_pathname.join('support', '**', '*.rb')].each do |f|
25
21
  require f
26
22
  end
27
23
 
24
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
28
25
  RSpec.configure do |config|
26
+ # rspec-expectations config goes here. You can use an alternate
27
+ # assertion/expectation library such as wrong or the stdlib/minitest
28
+ # assertions if you prefer.
29
+ config.expect_with :rspec do |expectations|
30
+ # This option will default to `true` in RSpec 4. It makes the `description`
31
+ # and `failure_message` of custom matchers include text for helper methods
32
+ # defined using `chain`, e.g.:
33
+ # be_bigger_than(2).and_smaller_than(4).description
34
+ # # => "be bigger than 2 and smaller than 4"
35
+ # ...rather than:
36
+ # # => "be bigger than 2"
37
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
38
+ end
39
+
40
+ # rspec-mocks config goes here. You can use an alternate test double
41
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
42
+ config.mock_with :rspec do |mocks|
43
+ # Prevents you from mocking or stubbing a method that does not exist on
44
+ # a real object. This is generally recommended, and will default to
45
+ # `true` in RSpec 4.
46
+ mocks.verify_partial_doubles = true
47
+ end
48
+
49
+ # These two settings work together to allow you to limit a spec run
50
+ # to individual examples or groups you care about by tagging them with
51
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
52
+ # get run.
53
+ config.filter_run :focus
54
+ config.run_all_when_everything_filtered = true
55
+
56
+ # Limits the available syntax to the non-monkey patched syntax that is
57
+ # recommended. For more details, see:
58
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
59
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
60
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
61
+ config.disable_monkey_patching!
62
+
63
+ # This setting enables warnings. It's recommended, but in some cases may
64
+ # be too noisy due to issues in dependencies.
65
+ config.warnings = true
66
+
67
+ # Many RSpec users commonly either run the entire suite or an individual
68
+ # file, and it's useful to allow more verbose output when running an
69
+ # individual spec file.
70
+ if config.files_to_run.one?
71
+ # Use the documentation formatter for detailed output,
72
+ # unless a formatter has already been configured
73
+ # (e.g. via a command-line flag).
74
+ config.default_formatter = 'doc'
75
+ end
76
+
77
+ # Print the 10 slowest examples and example groups at the
78
+ # end of the spec run, to help surface which specs are running
79
+ # particularly slow.
80
+ config.profile_examples = 10
81
+
82
+ # Run specs in random order to surface order dependencies. If you find an
83
+ # order dependency and want to debug it, you can fix the order by providing
84
+ # the seed, which is printed after each run.
85
+ # --seed 1234
86
+ config.order = :random
87
+
88
+ # Seed global randomization in this process using the `--seed` CLI option.
89
+ # Setting this allows you to use `--seed` to deterministically reproduce
90
+ # test failures related to randomization by passing the same `--seed` value
91
+ # as the one that triggered the failure.
92
+ Kernel.srand config.seed
93
+
29
94
  config.before(:suite) do
30
95
  # this must be explicitly set here because it should always be spec/tmp for w/e project is using
31
96
  # Metasploit::Model::Spec to handle file system clean up.
@@ -40,7 +105,4 @@ RSpec.configure do |config|
40
105
  config.after(:each) do
41
106
  Metasploit::Model::Spec.remove_temporary_pathname
42
107
  end
43
-
44
- config.mock_with :rspec
45
- config.order = :random
46
108
  end
@@ -1,4 +1,4 @@
1
- shared_context 'Metasploit::Model::Search::Operator::Group::Union#children' do
1
+ RSpec.shared_context 'Metasploit::Model::Search::Operator::Group::Union#children' do
2
2
  subject(:children) do
3
3
  operator.children(formatted_value)
4
4
  end
@@ -1,4 +1,4 @@
1
- shared_examples_for 'Metasploit::Model::Search::Operation::Value::Integer' do
1
+ RSpec.shared_examples_for 'Metasploit::Model::Search::Operation::Value::Integer' do
2
2
  let(:operation_class) do
3
3
  described_class
4
4
  end
@@ -8,7 +8,7 @@ shared_examples_for 'Metasploit::Model::Search::Operation::Value::Integer' do
8
8
  operation_class
9
9
  end
10
10
 
11
- it { should include Metasploit::Model::Search::Operation::Value::Integer }
11
+ it { is_expected.to include Metasploit::Model::Search::Operation::Value::Integer }
12
12
  end
13
13
 
14
14
  context '#value' do
@@ -26,7 +26,7 @@ shared_examples_for 'Metasploit::Model::Search::Operation::Value::Integer' do
26
26
  end
27
27
 
28
28
  it 'should pass through Integer' do
29
- value.should == formatted_value
29
+ expect(value).to eq(formatted_value)
30
30
  end
31
31
  end
32
32
 
@@ -40,7 +40,7 @@ shared_examples_for 'Metasploit::Model::Search::Operation::Value::Integer' do
40
40
  end
41
41
 
42
42
  it 'should convert String to Integer' do
43
- value.should == integer
43
+ expect(value).to eq(integer)
44
44
  end
45
45
  end
46
46
 
@@ -54,11 +54,11 @@ shared_examples_for 'Metasploit::Model::Search::Operation::Value::Integer' do
54
54
  end
55
55
 
56
56
  it 'should not extract the number' do
57
- value.should_not == integer
57
+ expect(value).not_to eq(integer)
58
58
  end
59
59
 
60
60
  it 'should pass through the full value' do
61
- value.should == formatted_value
61
+ expect(value).to eq(formatted_value)
62
62
  end
63
63
  end
64
64
 
@@ -68,11 +68,11 @@ shared_examples_for 'Metasploit::Model::Search::Operation::Value::Integer' do
68
68
  end
69
69
 
70
70
  it 'should not truncate Float to Integer' do
71
- value.should_not == formatted_value.to_i
71
+ expect(value).not_to eq(formatted_value.to_i)
72
72
  end
73
73
 
74
74
  it 'should pass through Float' do
75
- value.should == formatted_value
75
+ expect(value).to eq(formatted_value)
76
76
  end
77
77
  end
78
78
  end
@@ -1,4 +1,4 @@
1
- shared_examples_for 'Metasploit::Model::Search::Operation::Value::String' do
1
+ RSpec.shared_examples_for 'Metasploit::Model::Search::Operation::Value::String' do
2
2
  let(:operation_class) do
3
3
  described_class
4
4
  end
@@ -8,7 +8,7 @@ shared_examples_for 'Metasploit::Model::Search::Operation::Value::String' do
8
8
  operation_class
9
9
  end
10
10
 
11
- it { should include Metasploit::Model::Search::Operation::Value::String }
11
+ it { is_expected.to include Metasploit::Model::Search::Operation::Value::String }
12
12
  end
13
13
 
14
14
  context '#value' do
@@ -26,7 +26,7 @@ shared_examples_for 'Metasploit::Model::Search::Operation::Value::String' do
26
26
  end
27
27
 
28
28
  it 'should convert to String' do
29
- value.should == '5'
29
+ expect(value).to eq('5')
30
30
  end
31
31
  end
32
32
 
@@ -36,7 +36,7 @@ shared_examples_for 'Metasploit::Model::Search::Operation::Value::String' do
36
36
  end
37
37
 
38
38
  it 'should pass through String' do
39
- value.should == formatted_value
39
+ expect(value).to eq(formatted_value)
40
40
  end
41
41
  end
42
42
 
@@ -46,7 +46,7 @@ shared_examples_for 'Metasploit::Model::Search::Operation::Value::String' do
46
46
  end
47
47
 
48
48
  it 'should convert to String' do
49
- value.should == 'a_symbol'
49
+ expect(value).to eq('a_symbol')
50
50
  end
51
51
  end
52
52
  end
@@ -1,4 +1,4 @@
1
- shared_examples_for 'Metasploit::Model::Search::Operator::Help' do
1
+ RSpec.shared_examples_for 'Metasploit::Model::Search::Operator::Help' do
2
2
  context '#help' do
3
3
  subject(:help) do
4
4
  operator.help
@@ -24,7 +24,7 @@ shared_examples_for 'Metasploit::Model::Search::Operator::Help' do
24
24
  # klass needs to be named or model_name will fail.
25
25
  stub_const('Klass', klass)
26
26
  # since missing translations raise exceptions, and there is no translation for klass, have to stub out.
27
- klass.model_name.stub(:human).and_return(model)
27
+ allow(klass.model_name).to receive(:human).and_return(model)
28
28
 
29
29
  backend = I18n.backend
30
30
 
@@ -59,31 +59,31 @@ shared_examples_for 'Metasploit::Model::Search::Operator::Help' do
59
59
  end
60
60
 
61
61
  it 'should use #klass #i18n_scope to lookup translations specific to the #klass or one of its ancestors' do
62
- klass.should_receive(:i18n_scope).and_call_original
62
+ expect(klass).to receive(:i18n_scope).and_call_original
63
63
 
64
64
  help
65
65
  end
66
66
 
67
67
  it 'should lookup ancestors of #klass to find translations specific to #klass or its ancestors' do
68
- klass.should_receive(:lookup_ancestors).and_call_original
68
+ expect(klass).to receive(:lookup_ancestors).and_call_original
69
69
 
70
70
  help
71
71
  end
72
72
 
73
73
  it 'should use #class #i18n_scope to lookup translations specific to the operator class or one of its ancestors' do
74
- operator.class.should_receive(:i18n_scope)
74
+ expect(operator.class).to receive(:i18n_scope)
75
75
 
76
76
  help
77
77
  end
78
78
 
79
79
  it 'should lookup ancestors of the operator class to find translations specific to the operator class or one of its ancestors' do
80
- operator.class.should_receive(:lookup_ancestors).and_return([])
80
+ expect(operator.class).to receive(:lookup_ancestors).and_return([])
81
81
 
82
82
  help
83
83
  end
84
84
 
85
85
  it "should pass #klass translation key for operator with the given name as the primary translation key" do
86
- I18n.should_receive(:translate).with(
86
+ expect(I18n).to receive(:translate).with(
87
87
  :"#{klass.i18n_scope}.ancestors.#{klass.model_name.i18n_key}.search.operator.names.#{name}.help",
88
88
  anything
89
89
  )
@@ -92,23 +92,25 @@ shared_examples_for 'Metasploit::Model::Search::Operator::Help' do
92
92
  end
93
93
 
94
94
  it 'should pass other translation keys as default option' do
95
- I18n.should_receive(:translate) do |_key, options|
96
- options.should be_a Hash
95
+ expect(I18n).to receive(:translate) do |_key, options|
96
+ expect(options).to be_a Hash
97
97
 
98
98
  default = options[:default]
99
99
 
100
- default.should be_an Array
100
+ expect(default).to be_an Array
101
101
 
102
- default.all? { |key|
103
- key.is_a? Symbol
104
- }.should be_true
102
+ expect(
103
+ default.all? { |key|
104
+ key.is_a? Symbol
105
+ }
106
+ ).to eq(true)
105
107
  end
106
108
 
107
109
  help
108
110
  end
109
111
 
110
112
  it 'should pass #name of operator as name option' do
111
- I18n.should_receive(:translate).with(
113
+ expect(I18n).to receive(:translate).with(
112
114
  anything,
113
115
  hash_including(name: name)
114
116
  )
@@ -117,7 +119,7 @@ shared_examples_for 'Metasploit::Model::Search::Operator::Help' do
117
119
  end
118
120
 
119
121
  it 'should pass the human model name of #klass as model option' do
120
- I18n.should_receive(:translate).with(
122
+ expect(I18n).to receive(:translate).with(
121
123
  anything,
122
124
  hash_including(model: klass.model_name.human)
123
125
  )
@@ -126,7 +128,7 @@ shared_examples_for 'Metasploit::Model::Search::Operator::Help' do
126
128
  end
127
129
 
128
130
  it 'should be translated correctly' do
129
- help.should == help_template % { model: model, name: name }
131
+ expect(help).to eq(help_template % { model: model, name: name })
130
132
  end
131
133
  end
132
134
  end
@@ -1,4 +1,4 @@
1
- shared_examples_for 'Metasploit::Model::Translation' do |options={}|
1
+ RSpec.shared_examples_for 'Metasploit::Model::Translation' do |options={}|
2
2
  options.assert_valid_keys(:metasploit_model_ancestor)
3
3
 
4
4
  metasploit_model_ancestor = options.fetch(:metasploit_model_ancestor)
@@ -14,7 +14,7 @@ shared_examples_for 'Metasploit::Model::Translation' do |options={}|
14
14
  metasploit_model_ancestor.instance_variable_get :@_dependencies
15
15
  end
16
16
 
17
- it { should include Metasploit::Model::Translation }
17
+ it { is_expected.to include Metasploit::Model::Translation }
18
18
  end
19
19
  end
20
20
  end
@@ -24,7 +24,7 @@ shared_examples_for 'Metasploit::Model::Translation' do |options={}|
24
24
  base_class.i18n_scope
25
25
  end
26
26
 
27
- it { should == 'metasploit.model' }
27
+ it { is_expected.to eq('metasploit.model') }
28
28
  end
29
29
 
30
30
  context 'lookup_ancestors' do
@@ -32,6 +32,6 @@ shared_examples_for 'Metasploit::Model::Translation' do |options={}|
32
32
  base_class.lookup_ancestors
33
33
  end
34
34
 
35
- it { should include metasploit_model_ancestor }
35
+ it { is_expected.to include metasploit_model_ancestor }
36
36
  end
37
37
  end
@@ -1,4 +1,4 @@
1
- shared_examples_for 'search query' do |options={}|
1
+ RSpec.shared_examples_for 'search query' do |options={}|
2
2
  options.assert_valid_keys(:formatted_operator)
3
3
 
4
4
  formatted_operator = options.fetch(:formatted_operator)
@@ -35,8 +35,8 @@ shared_examples_for 'search query' do |options={}|
35
35
  }
36
36
  end
37
37
 
38
- it { should_not be_nil }
39
- it { should be_valid }
38
+ it { is_expected.not_to be_nil }
39
+ it { is_expected.to be_valid }
40
40
  end
41
41
  end
42
42
  end
@@ -1,5 +1,5 @@
1
- shared_examples_for 'search_association' do |association|
2
- context association do
1
+ RSpec.shared_examples_for 'search_association' do |association|
2
+ context association.to_s do
3
3
  let(:association_operators) do
4
4
  base_class.search_operator_by_name.select { |_name, operator|
5
5
  operator.respond_to?(:association) and operator.association == association
@@ -1,4 +1,4 @@
1
- shared_examples_for 'search_attribute' do |name, options={}|
1
+ RSpec.shared_examples_for 'search_attribute' do |name, options={}|
2
2
  options.assert_valid_keys(:type)
3
3
  type = options.fetch(:type)
4
4
 
@@ -19,8 +19,8 @@ shared_examples_for 'search_attribute' do |name, options={}|
19
19
  base_class.send(attribute_set_method_name)
20
20
  end
21
21
 
22
- it { should be_a Set }
23
- it { should_not be_empty }
22
+ it { is_expected.to be_a Set }
23
+ it { is_expected.not_to be_empty }
24
24
  end
25
25
  end
26
26
  end
@@ -1,12 +1,12 @@
1
- shared_examples_for 'search_with' do |operation_class, options={}|
1
+ RSpec.shared_examples_for 'search_with' do |operation_class, options={}|
2
2
  name = options.fetch(:name)
3
3
 
4
- context name do
4
+ context name.to_s do
5
5
  subject(:with_operator) do
6
6
  base_class.search_with_operator_by_name[name]
7
7
  end
8
8
 
9
- it { should be_a operation_class }
9
+ it { is_expected.to be_a operation_class }
10
10
 
11
11
  options.each do |key, value|
12
12
  # skip :name since it use used to look up operator, so it's already been checked or with_operator would be `nil`
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.30.0
4
+ version: 0.30.1
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-04-21 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler