metasploit_data_models 0.24.1.pre.rspec.pre.3.pre.1 → 0.24.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +3 -3
  3. data/Gemfile +3 -1
  4. data/app/models/metasploit_data_models/ip_address/v4/segmented.rb +1 -1
  5. data/app/models/metasploit_data_models/search/visitor/where.rb +1 -1
  6. data/app/validators/password_is_strong_validator.rb +1 -1
  7. data/lib/mdm/host/operating_system_normalization.rb +10 -0
  8. data/lib/metasploit_data_models/version.rb +1 -2
  9. data/metasploit_data_models.gemspec +1 -1
  10. data/spec/app/models/mdm/api_key_spec.rb +3 -1
  11. data/spec/app/models/mdm/client_spec.rb +11 -9
  12. data/spec/app/models/mdm/cred_spec.rb +54 -42
  13. data/spec/app/models/mdm/event_spec.rb +23 -21
  14. data/spec/app/models/mdm/exploit_attempt_spec.rb +21 -19
  15. data/spec/app/models/mdm/exploited_host_spec.rb +13 -11
  16. data/spec/app/models/mdm/host_detail_spec.rb +17 -15
  17. data/spec/app/models/mdm/host_spec.rb +260 -261
  18. data/spec/app/models/mdm/host_tag_spec.rb +8 -6
  19. data/spec/app/models/mdm/listener_spec.rb +32 -30
  20. data/spec/app/models/mdm/loot_spec.rb +23 -21
  21. data/spec/app/models/mdm/macro_spec.rb +3 -1
  22. data/spec/app/models/mdm/mod_ref_spec.rb +3 -1
  23. data/spec/app/models/mdm/module/action_spec.rb +12 -10
  24. data/spec/app/models/mdm/module/arch_spec.rb +12 -10
  25. data/spec/app/models/mdm/module/author_spec.rb +17 -22
  26. data/spec/app/models/mdm/module/detail_spec.rb +75 -184
  27. data/spec/app/models/mdm/module/mixin_spec.rb +12 -10
  28. data/spec/app/models/mdm/module/platform_spec.rb +12 -10
  29. data/spec/app/models/mdm/module/ref_spec.rb +12 -10
  30. data/spec/app/models/mdm/module/target_spec.rb +15 -13
  31. data/spec/app/models/mdm/nexpose_console_spec.rb +37 -35
  32. data/spec/app/models/mdm/note_spec.rb +25 -23
  33. data/spec/app/models/mdm/profile_spec.rb +3 -1
  34. data/spec/app/models/mdm/ref_spec.rb +12 -10
  35. data/spec/app/models/mdm/route_spec.rb +8 -6
  36. data/spec/app/models/mdm/service_spec.rb +40 -38
  37. data/spec/app/models/mdm/session_event_spec.rb +12 -10
  38. data/spec/app/models/mdm/session_spec.rb +15 -13
  39. data/spec/app/models/mdm/tag_spec.rb +29 -29
  40. data/spec/app/models/mdm/task_cred_spec.rb +11 -9
  41. data/spec/app/models/mdm/task_host_spec.rb +11 -9
  42. data/spec/app/models/mdm/task_service_spec.rb +11 -9
  43. data/spec/app/models/mdm/task_session_spec.rb +9 -7
  44. data/spec/app/models/mdm/task_spec.rb +29 -27
  45. data/spec/app/models/mdm/user_spec.rb +19 -17
  46. data/spec/app/models/mdm/vuln_attempt_spec.rb +16 -14
  47. data/spec/app/models/mdm/vuln_detail_spec.rb +28 -26
  48. data/spec/app/models/mdm/vuln_ref_spec.rb +10 -8
  49. data/spec/app/models/mdm/vuln_spec.rb +26 -24
  50. data/spec/app/models/mdm/web_form_spec.rb +13 -11
  51. data/spec/app/models/mdm/web_page_spec.rb +21 -19
  52. data/spec/app/models/mdm/web_site_spec.rb +23 -21
  53. data/spec/app/models/mdm/web_vuln_spec.rb +65 -63
  54. data/spec/app/models/mdm/wmap_request_spec.rb +3 -1
  55. data/spec/app/models/mdm/wmap_target_spec.rb +3 -1
  56. data/spec/app/models/mdm/workspace_spec.rb +100 -97
  57. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +5 -3
  58. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +15 -13
  59. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +3 -1
  60. data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +3 -1
  61. data/spec/app/models/metasploit_data_models/ip_address/v4/cidr_spec.rb +12 -10
  62. data/spec/app/models/metasploit_data_models/ip_address/v4/nmap_spec.rb +6 -4
  63. data/spec/app/models/metasploit_data_models/ip_address/v4/range_spec.rb +23 -21
  64. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list_spec.rb +11 -9
  65. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range_spec.rb +23 -21
  66. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/segmented_spec.rb +6 -4
  67. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +15 -22
  68. data/spec/app/models/metasploit_data_models/ip_address/v4/single_spec.rb +6 -4
  69. data/spec/app/models/metasploit_data_models/module_run_spec.rb +3 -1
  70. data/spec/app/models/metasploit_data_models/search/operation/ip_address_spec.rb +20 -18
  71. data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +8 -6
  72. data/spec/app/models/metasploit_data_models/search/operation/port/range_spec.rb +10 -8
  73. data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +10 -8
  74. data/spec/app/models/metasploit_data_models/search/operator/ip_address_spec.rb +4 -2
  75. data/spec/app/models/metasploit_data_models/search/operator/multitext_spec.rb +10 -8
  76. data/spec/app/models/metasploit_data_models/search/operator/port/list_spec.rb +8 -6
  77. data/spec/app/models/metasploit_data_models/search/visitor/attribute_spec.rb +11 -9
  78. data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +7 -5
  79. data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +19 -17
  80. data/spec/app/models/metasploit_data_models/search/visitor/method_spec.rb +7 -5
  81. data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +23 -61
  82. data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +10 -8
  83. data/spec/app/validators/parameters_validator_spec.rb +29 -29
  84. data/spec/app/validators/password_is_strong_validator_spec.rb +46 -54
  85. data/spec/factories/mdm/module/details.rb +1 -1
  86. data/spec/lib/base64_serializer_spec.rb +19 -19
  87. data/spec/lib/metasploit_data_models/ip_address/cidr_spec.rb +12 -18
  88. data/spec/lib/metasploit_data_models/ip_address/range_spec.rb +6 -4
  89. data/spec/lib/metasploit_data_models/match/child_spec.rb +4 -2
  90. data/spec/lib/metasploit_data_models/match/parent_spec.rb +6 -4
  91. data/spec/lib/metasploit_data_models/version_spec.rb +5 -3
  92. data/spec/spec_helper.rb +6 -72
  93. data/spec/support/shared/examples/mdm/module/detail/does_not_support_stance_with_mtype.rb +2 -2
  94. data/spec/support/shared/examples/mdm/module/detail/supports_stance_with_mtype.rb +4 -4
  95. data/spec/support/shared/examples/metasploit_data_models/search/operation/ipaddress/match.rb +2 -2
  96. data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb +5 -5
  97. data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_metasploit_model_search_operation_base.rb +5 -5
  98. data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_equality.rb +3 -3
  99. data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_metasploit_model_search_group_base.rb +6 -7
  100. metadata +7 -7
@@ -1,23 +1,25 @@
1
- RSpec.describe Mdm::TaskCred, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Mdm::TaskCred do
2
4
  it_should_behave_like 'Metasploit::Concern.run'
3
5
 
4
6
  context 'factory' do
5
7
  it 'should be valid' do
6
8
  task_cred = FactoryGirl.build(:mdm_task_cred)
7
- expect(task_cred).to be_valid
9
+ task_cred.should be_valid
8
10
  end
9
11
  end
10
12
 
11
13
  context 'database' do
12
14
 
13
15
  context 'timestamps'do
14
- it { is_expected.to have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
15
- it { is_expected.to have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
16
+ it { should have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
17
+ it { should have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
16
18
  end
17
19
 
18
20
  context 'columns' do
19
- it { is_expected.to have_db_column(:task_id).of_type(:integer).with_options(:null => false) }
20
- it { is_expected.to have_db_column(:cred_id).of_type(:integer).with_options(:null => false) }
21
+ it { should have_db_column(:task_id).of_type(:integer).with_options(:null => false) }
22
+ it { should have_db_column(:cred_id).of_type(:integer).with_options(:null => false) }
21
23
  end
22
24
  end
23
25
 
@@ -34,8 +36,8 @@ RSpec.describe Mdm::TaskCred, type: :model do
34
36
  end
35
37
 
36
38
  context "Associations" do
37
- it { is_expected.to belong_to(:task).class_name('Mdm::Task') }
38
- it { is_expected.to belong_to(:cred).class_name('Mdm::Cred') }
39
+ it { should belong_to(:task).class_name('Mdm::Task') }
40
+ it { should belong_to(:cred).class_name('Mdm::Cred') }
39
41
  end
40
42
 
41
43
  context "validations" do
@@ -44,7 +46,7 @@ RSpec.describe Mdm::TaskCred, type: :model do
44
46
  cred = FactoryGirl.build(:mdm_cred)
45
47
  FactoryGirl.create(:mdm_task_cred, :task => task, :cred => cred)
46
48
  task_cred2 = FactoryGirl.build(:mdm_task_cred, :task => task, :cred => cred)
47
- expect(task_cred2).not_to be_valid
49
+ task_cred2.should_not be_valid
48
50
  end
49
51
  end
50
52
 
@@ -1,23 +1,25 @@
1
- RSpec.describe Mdm::TaskHost, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Mdm::TaskHost do
2
4
  it_should_behave_like 'Metasploit::Concern.run'
3
5
 
4
6
  context 'factory' do
5
7
  it 'should be valid' do
6
8
  task_host = FactoryGirl.build(:mdm_task_host)
7
- expect(task_host).to be_valid
9
+ task_host.should be_valid
8
10
  end
9
11
  end
10
12
 
11
13
  context 'database' do
12
14
 
13
15
  context 'timestamps'do
14
- it { is_expected.to have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
15
- it { is_expected.to have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
16
+ it { should have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
17
+ it { should have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
16
18
  end
17
19
 
18
20
  context 'columns' do
19
- it { is_expected.to have_db_column(:task_id).of_type(:integer).with_options(:null => false) }
20
- it { is_expected.to have_db_column(:host_id).of_type(:integer).with_options(:null => false) }
21
+ it { should have_db_column(:task_id).of_type(:integer).with_options(:null => false) }
22
+ it { should have_db_column(:host_id).of_type(:integer).with_options(:null => false) }
21
23
  end
22
24
  end
23
25
 
@@ -34,8 +36,8 @@ RSpec.describe Mdm::TaskHost, type: :model do
34
36
  end
35
37
 
36
38
  context "Associations" do
37
- it { is_expected.to belong_to(:task).class_name('Mdm::Task') }
38
- it { is_expected.to belong_to(:host).class_name('Mdm::Host') }
39
+ it { should belong_to(:task).class_name('Mdm::Task') }
40
+ it { should belong_to(:host).class_name('Mdm::Host') }
39
41
  end
40
42
 
41
43
  context "validations" do
@@ -44,7 +46,7 @@ RSpec.describe Mdm::TaskHost, type: :model do
44
46
  host = FactoryGirl.build(:mdm_host)
45
47
  FactoryGirl.create(:mdm_task_host, :task => task, :host => host)
46
48
  task_host2 = FactoryGirl.build(:mdm_task_host, :task => task, :host => host)
47
- expect(task_host2).not_to be_valid
49
+ task_host2.should_not be_valid
48
50
  end
49
51
  end
50
52
  end
@@ -1,23 +1,25 @@
1
- RSpec.describe Mdm::TaskService, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Mdm::TaskService do
2
4
  it_should_behave_like 'Metasploit::Concern.run'
3
5
 
4
6
  context 'factory' do
5
7
  it 'should be valid' do
6
8
  task_service = FactoryGirl.build(:mdm_task_service)
7
- expect(task_service).to be_valid
9
+ task_service.should be_valid
8
10
  end
9
11
  end
10
12
 
11
13
  context 'database' do
12
14
 
13
15
  context 'timestamps'do
14
- it { is_expected.to have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
15
- it { is_expected.to have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
16
+ it { should have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
17
+ it { should have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
16
18
  end
17
19
 
18
20
  context 'columns' do
19
- it { is_expected.to have_db_column(:task_id).of_type(:integer).with_options(:null => false) }
20
- it { is_expected.to have_db_column(:service_id).of_type(:integer).with_options(:null => false) }
21
+ it { should have_db_column(:task_id).of_type(:integer).with_options(:null => false) }
22
+ it { should have_db_column(:service_id).of_type(:integer).with_options(:null => false) }
21
23
  end
22
24
  end
23
25
 
@@ -34,8 +36,8 @@ RSpec.describe Mdm::TaskService, type: :model do
34
36
  end
35
37
 
36
38
  context "Associations" do
37
- it { is_expected.to belong_to(:task).class_name('Mdm::Task') }
38
- it { is_expected.to belong_to(:service).class_name('Mdm::Service') }
39
+ it { should belong_to(:task).class_name('Mdm::Task') }
40
+ it { should belong_to(:service).class_name('Mdm::Service') }
39
41
  end
40
42
 
41
43
  context "validations" do
@@ -44,7 +46,7 @@ RSpec.describe Mdm::TaskService, type: :model do
44
46
  service = FactoryGirl.build(:mdm_service)
45
47
  FactoryGirl.create(:mdm_task_service, :task => task, :service => service)
46
48
  task_service2 = FactoryGirl.build(:mdm_task_service, :task => task, :service => service)
47
- expect(task_service2).not_to be_valid
49
+ task_service2.should_not be_valid
48
50
  end
49
51
  end
50
52
  end
@@ -1,23 +1,25 @@
1
- RSpec.describe Mdm::TaskSession, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Mdm::TaskSession do
2
4
  it_should_behave_like 'Metasploit::Concern.run'
3
5
 
4
6
  context 'factory' do
5
7
  it 'should be valid' do
6
8
  task_session = FactoryGirl.build(:mdm_task_session)
7
- expect(task_session).to be_valid
9
+ task_session.should be_valid
8
10
  end
9
11
  end
10
12
 
11
13
  context 'database' do
12
14
 
13
15
  context 'timestamps'do
14
- it { is_expected.to have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
15
- it { is_expected.to have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
16
+ it { should have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
17
+ it { should have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
16
18
  end
17
19
 
18
20
  context 'columns' do
19
- it { is_expected.to have_db_column(:task_id).of_type(:integer).with_options(:null => false) }
20
- it { is_expected.to have_db_column(:session_id).of_type(:integer).with_options(:null => false) }
21
+ it { should have_db_column(:task_id).of_type(:integer).with_options(:null => false) }
22
+ it { should have_db_column(:session_id).of_type(:integer).with_options(:null => false) }
21
23
  end
22
24
  end
23
25
 
@@ -39,7 +41,7 @@ RSpec.describe Mdm::TaskSession, type: :model do
39
41
  session = FactoryGirl.build(:mdm_session)
40
42
  FactoryGirl.create(:mdm_task_session, :task => task, :session => session)
41
43
  task_session2 = FactoryGirl.build(:mdm_task_session, :task => task, :session => session)
42
- expect(task_session2).not_to be_valid
44
+ task_session2.should_not be_valid
43
45
  end
44
46
  end
45
47
 
@@ -1,34 +1,36 @@
1
- RSpec.describe Mdm::Task, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Mdm::Task do
2
4
  it_should_behave_like 'Metasploit::Concern.run'
3
5
 
4
6
  context 'factory' do
5
7
  it 'should be valid' do
6
8
  task = FactoryGirl.build(:mdm_task)
7
- expect(task).to be_valid
9
+ task.should be_valid
8
10
  end
9
11
  end
10
12
 
11
13
  context 'database' do
12
14
 
13
15
  context 'timestamps'do
14
- it { is_expected.to have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
15
- it { is_expected.to have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
16
- it { is_expected.to have_db_column(:completed_at).of_type(:datetime) }
16
+ it { should have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
17
+ it { should have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
18
+ it { should have_db_column(:completed_at).of_type(:datetime) }
17
19
  end
18
20
 
19
21
  context 'columns' do
20
- it { is_expected.to have_db_column(:workspace_id).of_type(:integer).with_options(:null => false, :default =>1) }
21
- it { is_expected.to have_db_column(:created_by).of_type(:string) }
22
- it { is_expected.to have_db_column(:module).of_type(:string) }
23
- it { is_expected.to have_db_column(:path).of_type(:string) }
24
- it { is_expected.to have_db_column(:info).of_type(:string) }
25
- it { is_expected.to have_db_column(:description).of_type(:string) }
26
- it { is_expected.to have_db_column(:progress).of_type(:integer) }
27
- it { is_expected.to have_db_column(:options).of_type(:text) }
28
- it { is_expected.to have_db_column(:error).of_type(:text) }
29
- it { is_expected.to have_db_column(:result).of_type(:text) }
30
- it { is_expected.to have_db_column(:module_uuid).of_type(:string) }
31
- it { is_expected.to have_db_column(:settings).of_type(:binary) }
22
+ it { should have_db_column(:workspace_id).of_type(:integer).with_options(:null => false, :default =>1) }
23
+ it { should have_db_column(:created_by).of_type(:string) }
24
+ it { should have_db_column(:module).of_type(:string) }
25
+ it { should have_db_column(:path).of_type(:string) }
26
+ it { should have_db_column(:info).of_type(:string) }
27
+ it { should have_db_column(:description).of_type(:string) }
28
+ it { should have_db_column(:progress).of_type(:integer) }
29
+ it { should have_db_column(:options).of_type(:text) }
30
+ it { should have_db_column(:error).of_type(:text) }
31
+ it { should have_db_column(:result).of_type(:text) }
32
+ it { should have_db_column(:module_uuid).of_type(:string) }
33
+ it { should have_db_column(:settings).of_type(:binary) }
32
34
  end
33
35
  end
34
36
 
@@ -45,15 +47,15 @@ RSpec.describe Mdm::Task, type: :model do
45
47
  end
46
48
 
47
49
  context "Associations" do
48
- it { is_expected.to have_many(:task_creds).class_name('Mdm::TaskCred').dependent(:destroy) }
49
- it { is_expected.to have_many(:creds).class_name('Mdm::Cred').through(:task_creds) }
50
- it { is_expected.to have_many(:task_sessions).class_name('Mdm::TaskSession').dependent(:destroy) }
51
- it { is_expected.to have_many(:sessions).class_name('Mdm::Session').through(:task_sessions) }
52
- it { is_expected.to have_many(:task_hosts).class_name('Mdm::TaskHost').dependent(:destroy) }
53
- it { is_expected.to have_many(:hosts).class_name('Mdm::Host').through(:task_hosts) }
54
- it { is_expected.to have_many(:task_services).class_name('Mdm::TaskService').dependent(:destroy) }
55
- it { is_expected.to have_many(:services).class_name('Mdm::Service').through(:task_services) }
56
- it { is_expected.to belong_to(:workspace).class_name('Mdm::Workspace') }
50
+ it { should have_many(:task_creds).class_name('Mdm::TaskCred').dependent(:destroy) }
51
+ it { should have_many(:creds).class_name('Mdm::Cred').through(:task_creds) }
52
+ it { should have_many(:task_sessions).class_name('Mdm::TaskSession').dependent(:destroy) }
53
+ it { should have_many(:sessions).class_name('Mdm::Session').through(:task_sessions) }
54
+ it { should have_many(:task_hosts).class_name('Mdm::TaskHost').dependent(:destroy) }
55
+ it { should have_many(:hosts).class_name('Mdm::Host').through(:task_hosts) }
56
+ it { should have_many(:task_services).class_name('Mdm::TaskService').dependent(:destroy) }
57
+ it { should have_many(:services).class_name('Mdm::Service').through(:task_services) }
58
+ it { should belong_to(:workspace).class_name('Mdm::Workspace') }
57
59
 
58
60
  end
59
61
 
@@ -61,7 +63,7 @@ RSpec.describe Mdm::Task, type: :model do
61
63
  context 'before_destroy' do
62
64
  it 'should call #delete_file' do
63
65
  task = FactoryGirl.create(:mdm_task)
64
- expect(task).to receive(:delete_file)
66
+ task.should_receive(:delete_file)
65
67
  task.destroy
66
68
  end
67
69
  end
@@ -1,37 +1,39 @@
1
- RSpec.describe Mdm::User, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Mdm::User do
2
4
  it_should_behave_like 'Metasploit::Concern.run'
3
5
 
4
6
  context 'associations' do
5
- it { is_expected.to have_many(:owned_workspaces).class_name('Mdm::Workspace') }
6
- it { is_expected.to have_many(:tags).class_name('Mdm::Tag') }
7
- it { is_expected.to have_and_belong_to_many(:workspaces).class_name('Mdm::Workspace') }
7
+ it { should have_many(:owned_workspaces).class_name('Mdm::Workspace') }
8
+ it { should have_many(:tags).class_name('Mdm::Tag') }
9
+ it { should have_and_belong_to_many(:workspaces).class_name('Mdm::Workspace') }
8
10
  end
9
11
 
10
12
  context 'database' do
11
13
 
12
14
  context 'timestamps'do
13
- it { is_expected.to have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
14
- it { is_expected.to have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
15
+ it { should have_db_column(:created_at).of_type(:datetime).with_options(:null => false) }
16
+ it { should have_db_column(:updated_at).of_type(:datetime).with_options(:null => false) }
15
17
  end
16
18
 
17
19
  context 'columns' do
18
- it { is_expected.to have_db_column(:username).of_type(:string) }
19
- it { is_expected.to have_db_column(:crypted_password).of_type(:string) }
20
- it { is_expected.to have_db_column(:password_salt).of_type(:string) }
21
- it { is_expected.to have_db_column(:persistence_token).of_type(:string) }
22
- it { is_expected.to have_db_column(:fullname).of_type(:string) }
23
- it { is_expected.to have_db_column(:email).of_type(:string) }
24
- it { is_expected.to have_db_column(:phone).of_type(:string) }
25
- it { is_expected.to have_db_column(:company).of_type(:string) }
26
- it { is_expected.to have_db_column(:prefs).of_type(:string) }
27
- it { is_expected.to have_db_column(:admin).of_type(:boolean).with_options(:null => false, :default =>true) }
20
+ it { should have_db_column(:username).of_type(:string) }
21
+ it { should have_db_column(:crypted_password).of_type(:string) }
22
+ it { should have_db_column(:password_salt).of_type(:string) }
23
+ it { should have_db_column(:persistence_token).of_type(:string) }
24
+ it { should have_db_column(:fullname).of_type(:string) }
25
+ it { should have_db_column(:email).of_type(:string) }
26
+ it { should have_db_column(:phone).of_type(:string) }
27
+ it { should have_db_column(:company).of_type(:string) }
28
+ it { should have_db_column(:prefs).of_type(:string) }
29
+ it { should have_db_column(:admin).of_type(:boolean).with_options(:null => false, :default =>true) }
28
30
  end
29
31
  end
30
32
 
31
33
  context 'factory' do
32
34
  it 'should be valid' do
33
35
  user = FactoryGirl.build(:mdm_user)
34
- expect(user).to be_valid
36
+ user.should be_valid
35
37
  end
36
38
  end
37
39
 
@@ -1,40 +1,42 @@
1
- RSpec.describe Mdm::VulnAttempt, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Mdm::VulnAttempt do
2
4
  it_should_behave_like 'Metasploit::Concern.run'
3
5
 
4
6
  context 'association' do
5
- it { is_expected.to belong_to(:vuln).class_name('Mdm::Vuln') }
7
+ it { should belong_to(:vuln).class_name('Mdm::Vuln') }
6
8
  end
7
9
 
8
10
  context 'database' do
9
11
 
10
12
  context 'timestamps'do
11
- it { is_expected.to have_db_column(:attempted_at).of_type(:datetime) }
13
+ it { should have_db_column(:attempted_at).of_type(:datetime) }
12
14
  end
13
15
 
14
16
  context 'columns' do
15
- it { is_expected.to have_db_column(:vuln_id).of_type(:integer) }
16
- it { is_expected.to have_db_column(:exploited).of_type(:boolean) }
17
- it { is_expected.to have_db_column(:fail_reason).of_type(:string) }
18
- it { is_expected.to have_db_column(:username).of_type(:string) }
19
- it { is_expected.to have_db_column(:module).of_type(:text) }
20
- it { is_expected.to have_db_column(:session_id).of_type(:integer) }
21
- it { is_expected.to have_db_column(:loot_id).of_type(:integer) }
22
- it { is_expected.to have_db_column(:fail_detail).of_type(:text) }
17
+ it { should have_db_column(:vuln_id).of_type(:integer) }
18
+ it { should have_db_column(:exploited).of_type(:boolean) }
19
+ it { should have_db_column(:fail_reason).of_type(:string) }
20
+ it { should have_db_column(:username).of_type(:string) }
21
+ it { should have_db_column(:module).of_type(:text) }
22
+ it { should have_db_column(:session_id).of_type(:integer) }
23
+ it { should have_db_column(:loot_id).of_type(:integer) }
24
+ it { should have_db_column(:fail_detail).of_type(:text) }
23
25
  end
24
26
  end
25
27
 
26
28
  context 'validations' do
27
29
  it 'should require a vuln_id' do
28
30
  orphan_detail = FactoryGirl.build(:mdm_vuln_detail, :vuln => nil)
29
- expect(orphan_detail).not_to be_valid
30
- expect(orphan_detail.errors[:vuln_id]).to include("can't be blank")
31
+ orphan_detail.should_not be_valid
32
+ orphan_detail.errors[:vuln_id].should include("can't be blank")
31
33
  end
32
34
  end
33
35
 
34
36
  context 'factory' do
35
37
  it 'should be valid' do
36
38
  vuln_attempt = FactoryGirl.build(:mdm_vuln_attempt)
37
- expect(vuln_attempt).to be_valid
39
+ vuln_attempt.should be_valid
38
40
  end
39
41
  end
40
42
 
@@ -1,52 +1,54 @@
1
- RSpec.describe Mdm::VulnDetail, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Mdm::VulnDetail do
2
4
  it_should_behave_like 'Metasploit::Concern.run'
3
5
 
4
6
  context 'association' do
5
- it { is_expected.to belong_to(:vuln).class_name('Mdm::Vuln') }
7
+ it { should belong_to(:vuln).class_name('Mdm::Vuln') }
6
8
  end
7
9
 
8
10
  context 'database' do
9
11
 
10
12
  context 'timestamps'do
11
- it { is_expected.to have_db_column(:nx_published).of_type(:datetime) }
12
- it { is_expected.to have_db_column(:nx_added).of_type(:datetime) }
13
- it { is_expected.to have_db_column(:nx_modified).of_type(:datetime) }
14
- it { is_expected.to have_db_column(:nx_vulnerable_since).of_type(:datetime) }
13
+ it { should have_db_column(:nx_published).of_type(:datetime) }
14
+ it { should have_db_column(:nx_added).of_type(:datetime) }
15
+ it { should have_db_column(:nx_modified).of_type(:datetime) }
16
+ it { should have_db_column(:nx_vulnerable_since).of_type(:datetime) }
15
17
  end
16
18
 
17
19
  context 'columns' do
18
- it { is_expected.to have_db_column(:vuln_id).of_type(:integer)}
19
- it { is_expected.to have_db_column(:cvss_score).of_type(:float) }
20
- it { is_expected.to have_db_column(:cvss_vector).of_type(:string) }
21
- it { is_expected.to have_db_column(:title).of_type(:string) }
22
- it { is_expected.to have_db_column(:description).of_type(:text) }
23
- it { is_expected.to have_db_column(:solution).of_type(:text) }
24
- it { is_expected.to have_db_column(:proof).of_type(:binary) }
25
- it { is_expected.to have_db_column(:nx_console_id).of_type(:integer) }
26
- it { is_expected.to have_db_column(:nx_device_id).of_type(:integer) }
27
- it { is_expected.to have_db_column(:nx_severity).of_type(:float) }
28
- it { is_expected.to have_db_column(:nx_pci_severity).of_type(:float) }
29
- it { is_expected.to have_db_column(:nx_tags).of_type(:text) }
30
- it { is_expected.to have_db_column(:nx_vuln_status).of_type(:text) }
31
- it { is_expected.to have_db_column(:nx_proof_key).of_type(:text) }
32
- it { is_expected.to have_db_column(:src).of_type(:string) }
33
- it { is_expected.to have_db_column(:nx_scan_id).of_type(:integer) }
34
- it { is_expected.to have_db_column(:nx_pci_compliance_status).of_type(:string) }
20
+ it { should have_db_column(:vuln_id).of_type(:integer)}
21
+ it { should have_db_column(:cvss_score).of_type(:float) }
22
+ it { should have_db_column(:cvss_vector).of_type(:string) }
23
+ it { should have_db_column(:title).of_type(:string) }
24
+ it { should have_db_column(:description).of_type(:text) }
25
+ it { should have_db_column(:solution).of_type(:text) }
26
+ it { should have_db_column(:proof).of_type(:binary) }
27
+ it { should have_db_column(:nx_console_id).of_type(:integer) }
28
+ it { should have_db_column(:nx_device_id).of_type(:integer) }
29
+ it { should have_db_column(:nx_severity).of_type(:float) }
30
+ it { should have_db_column(:nx_pci_severity).of_type(:float) }
31
+ it { should have_db_column(:nx_tags).of_type(:text) }
32
+ it { should have_db_column(:nx_vuln_status).of_type(:text) }
33
+ it { should have_db_column(:nx_proof_key).of_type(:text) }
34
+ it { should have_db_column(:src).of_type(:string) }
35
+ it { should have_db_column(:nx_scan_id).of_type(:integer) }
36
+ it { should have_db_column(:nx_pci_compliance_status).of_type(:string) }
35
37
  end
36
38
  end
37
39
 
38
40
  context 'validations' do
39
41
  it 'should require a vuln_id' do
40
42
  orphan_detail = FactoryGirl.build(:mdm_vuln_detail, :vuln => nil)
41
- expect(orphan_detail).not_to be_valid
42
- expect(orphan_detail.errors[:vuln_id]).to include("can't be blank")
43
+ orphan_detail.should_not be_valid
44
+ orphan_detail.errors[:vuln_id].should include("can't be blank")
43
45
  end
44
46
  end
45
47
 
46
48
  context 'factory' do
47
49
  it 'should be valid' do
48
50
  vuln_detail = FactoryGirl.build(:mdm_vuln_detail)
49
- expect(vuln_detail).to be_valid
51
+ vuln_detail.should be_valid
50
52
  end
51
53
  end
52
54