metasploit_data_models 0.24.0 → 0.24.1.pre.rspec.pre.3.pre.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 +1 -3
  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 +0 -10
  8. data/lib/metasploit_data_models/version.rb +2 -2
  9. data/metasploit_data_models.gemspec +1 -1
  10. data/spec/app/models/mdm/api_key_spec.rb +1 -3
  11. data/spec/app/models/mdm/client_spec.rb +9 -11
  12. data/spec/app/models/mdm/cred_spec.rb +42 -54
  13. data/spec/app/models/mdm/event_spec.rb +21 -23
  14. data/spec/app/models/mdm/exploit_attempt_spec.rb +19 -21
  15. data/spec/app/models/mdm/exploited_host_spec.rb +11 -13
  16. data/spec/app/models/mdm/host_detail_spec.rb +15 -17
  17. data/spec/app/models/mdm/host_spec.rb +261 -260
  18. data/spec/app/models/mdm/host_tag_spec.rb +6 -8
  19. data/spec/app/models/mdm/listener_spec.rb +30 -32
  20. data/spec/app/models/mdm/loot_spec.rb +21 -23
  21. data/spec/app/models/mdm/macro_spec.rb +1 -3
  22. data/spec/app/models/mdm/mod_ref_spec.rb +1 -3
  23. data/spec/app/models/mdm/module/action_spec.rb +10 -12
  24. data/spec/app/models/mdm/module/arch_spec.rb +10 -12
  25. data/spec/app/models/mdm/module/author_spec.rb +22 -17
  26. data/spec/app/models/mdm/module/detail_spec.rb +184 -75
  27. data/spec/app/models/mdm/module/mixin_spec.rb +10 -12
  28. data/spec/app/models/mdm/module/platform_spec.rb +10 -12
  29. data/spec/app/models/mdm/module/ref_spec.rb +10 -12
  30. data/spec/app/models/mdm/module/target_spec.rb +13 -15
  31. data/spec/app/models/mdm/nexpose_console_spec.rb +35 -37
  32. data/spec/app/models/mdm/note_spec.rb +23 -25
  33. data/spec/app/models/mdm/profile_spec.rb +1 -3
  34. data/spec/app/models/mdm/ref_spec.rb +10 -12
  35. data/spec/app/models/mdm/route_spec.rb +6 -8
  36. data/spec/app/models/mdm/service_spec.rb +38 -40
  37. data/spec/app/models/mdm/session_event_spec.rb +10 -12
  38. data/spec/app/models/mdm/session_spec.rb +13 -15
  39. data/spec/app/models/mdm/tag_spec.rb +29 -29
  40. data/spec/app/models/mdm/task_cred_spec.rb +9 -11
  41. data/spec/app/models/mdm/task_host_spec.rb +9 -11
  42. data/spec/app/models/mdm/task_service_spec.rb +9 -11
  43. data/spec/app/models/mdm/task_session_spec.rb +7 -9
  44. data/spec/app/models/mdm/task_spec.rb +27 -29
  45. data/spec/app/models/mdm/user_spec.rb +17 -19
  46. data/spec/app/models/mdm/vuln_attempt_spec.rb +14 -16
  47. data/spec/app/models/mdm/vuln_detail_spec.rb +26 -28
  48. data/spec/app/models/mdm/vuln_ref_spec.rb +8 -10
  49. data/spec/app/models/mdm/vuln_spec.rb +24 -26
  50. data/spec/app/models/mdm/web_form_spec.rb +11 -13
  51. data/spec/app/models/mdm/web_page_spec.rb +19 -21
  52. data/spec/app/models/mdm/web_site_spec.rb +21 -23
  53. data/spec/app/models/mdm/web_vuln_spec.rb +63 -65
  54. data/spec/app/models/mdm/wmap_request_spec.rb +1 -3
  55. data/spec/app/models/mdm/wmap_target_spec.rb +1 -3
  56. data/spec/app/models/mdm/workspace_spec.rb +97 -100
  57. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +3 -5
  58. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +13 -15
  59. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +1 -3
  60. data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +1 -3
  61. data/spec/app/models/metasploit_data_models/ip_address/v4/cidr_spec.rb +10 -12
  62. data/spec/app/models/metasploit_data_models/ip_address/v4/nmap_spec.rb +4 -6
  63. data/spec/app/models/metasploit_data_models/ip_address/v4/range_spec.rb +21 -23
  64. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list_spec.rb +9 -11
  65. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range_spec.rb +21 -23
  66. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/segmented_spec.rb +4 -6
  67. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +22 -15
  68. data/spec/app/models/metasploit_data_models/ip_address/v4/single_spec.rb +4 -6
  69. data/spec/app/models/metasploit_data_models/module_run_spec.rb +1 -3
  70. data/spec/app/models/metasploit_data_models/search/operation/ip_address_spec.rb +18 -20
  71. data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +6 -8
  72. data/spec/app/models/metasploit_data_models/search/operation/port/range_spec.rb +8 -10
  73. data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +8 -10
  74. data/spec/app/models/metasploit_data_models/search/operator/ip_address_spec.rb +2 -4
  75. data/spec/app/models/metasploit_data_models/search/operator/multitext_spec.rb +8 -10
  76. data/spec/app/models/metasploit_data_models/search/operator/port/list_spec.rb +6 -8
  77. data/spec/app/models/metasploit_data_models/search/visitor/attribute_spec.rb +9 -11
  78. data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +5 -7
  79. data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +17 -19
  80. data/spec/app/models/metasploit_data_models/search/visitor/method_spec.rb +5 -7
  81. data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +61 -23
  82. data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +8 -10
  83. data/spec/app/validators/parameters_validator_spec.rb +29 -29
  84. data/spec/app/validators/password_is_strong_validator_spec.rb +54 -46
  85. data/spec/dummy/db/structure.sql +1 -0
  86. data/spec/lib/base64_serializer_spec.rb +19 -19
  87. data/spec/lib/metasploit_data_models/ip_address/cidr_spec.rb +18 -12
  88. data/spec/lib/metasploit_data_models/ip_address/range_spec.rb +4 -6
  89. data/spec/lib/metasploit_data_models/match/child_spec.rb +2 -4
  90. data/spec/lib/metasploit_data_models/match/parent_spec.rb +4 -6
  91. data/spec/lib/metasploit_data_models/version_spec.rb +3 -5
  92. data/spec/spec_helper.rb +72 -6
  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 +7 -6
  100. metadata +6 -6
@@ -1,21 +1,19 @@
1
- require 'spec_helper'
2
-
3
- describe Mdm::Module::Mixin do
1
+ RSpec.describe Mdm::Module::Mixin, type: :model do
4
2
 
5
3
  it_should_behave_like 'Metasploit::Concern.run'
6
4
 
7
5
  context 'associations' do
8
- it { should belong_to(:detail).class_name('Mdm::Module::Detail') }
6
+ it { is_expected.to belong_to(:detail).class_name('Mdm::Module::Detail') }
9
7
  end
10
8
 
11
9
  context 'database' do
12
10
  context 'columns' do
13
- it { should have_db_column(:detail_id).of_type(:integer) }
14
- it { should have_db_column(:name).of_type(:text) }
11
+ it { is_expected.to have_db_column(:detail_id).of_type(:integer) }
12
+ it { is_expected.to have_db_column(:name).of_type(:text) }
15
13
  end
16
14
 
17
15
  context 'indices' do
18
- it { should have_db_index(:detail_id) }
16
+ it { is_expected.to have_db_index(:detail_id) }
19
17
  end
20
18
  end
21
19
 
@@ -25,17 +23,17 @@ describe Mdm::Module::Mixin do
25
23
  FactoryGirl.build :mdm_module_mixin
26
24
  end
27
25
 
28
- it { should be_valid }
26
+ it { is_expected.to be_valid }
29
27
  end
30
28
  end
31
29
 
32
30
  context 'mass assignment security' do
33
- it { should_not allow_mass_assignment_of(:detail_id) }
34
- it { should allow_mass_assignment_of(:name) }
31
+ it { is_expected.not_to allow_mass_assignment_of(:detail_id) }
32
+ it { is_expected.to allow_mass_assignment_of(:name) }
35
33
  end
36
34
 
37
35
  context 'validations' do
38
- it { should validate_presence_of(:detail) }
39
- it { should validate_presence_of(:name) }
36
+ it { is_expected.to validate_presence_of(:detail) }
37
+ it { is_expected.to validate_presence_of(:name) }
40
38
  end
41
39
  end
@@ -1,21 +1,19 @@
1
- require 'spec_helper'
2
-
3
- describe Mdm::Module::Platform do
1
+ RSpec.describe Mdm::Module::Platform, type: :model do
4
2
 
5
3
  it_should_behave_like 'Metasploit::Concern.run'
6
4
 
7
5
  context 'associations' do
8
- it { should belong_to(:detail).class_name('Mdm::Module::Detail') }
6
+ it { is_expected.to belong_to(:detail).class_name('Mdm::Module::Detail') }
9
7
  end
10
8
 
11
9
  context 'database' do
12
10
  context 'columns' do
13
- it { should have_db_column(:detail_id).of_type(:integer) }
14
- it { should have_db_column(:name).of_type(:text) }
11
+ it { is_expected.to have_db_column(:detail_id).of_type(:integer) }
12
+ it { is_expected.to have_db_column(:name).of_type(:text) }
15
13
  end
16
14
 
17
15
  context 'indices' do
18
- it { should have_db_index(:detail_id) }
16
+ it { is_expected.to have_db_index(:detail_id) }
19
17
  end
20
18
  end
21
19
 
@@ -25,17 +23,17 @@ describe Mdm::Module::Platform do
25
23
  FactoryGirl.build :mdm_module_platform
26
24
  end
27
25
 
28
- it { should be_valid }
26
+ it { is_expected.to be_valid }
29
27
  end
30
28
  end
31
29
 
32
30
  context 'mass assignment security' do
33
- it { should_not allow_mass_assignment_of(:detail_id) }
34
- it { should allow_mass_assignment_of(:name) }
31
+ it { is_expected.not_to allow_mass_assignment_of(:detail_id) }
32
+ it { is_expected.to allow_mass_assignment_of(:name) }
35
33
  end
36
34
 
37
35
  context 'validations' do
38
- it { should validate_presence_of :detail }
39
- it { should validate_presence_of :name }
36
+ it { is_expected.to validate_presence_of :detail }
37
+ it { is_expected.to validate_presence_of :name }
40
38
  end
41
39
  end
@@ -1,11 +1,9 @@
1
- require 'spec_helper'
2
-
3
- describe Mdm::Module::Ref do
1
+ RSpec.describe Mdm::Module::Ref, type: :model do
4
2
 
5
3
  it_should_behave_like 'Metasploit::Concern.run'
6
4
 
7
5
  context 'associations' do
8
- it { should belong_to(:detail).class_name('Mdm::Module::Detail') }
6
+ it { is_expected.to belong_to(:detail).class_name('Mdm::Module::Detail') }
9
7
 
10
8
  # shoulda matchers don't have support for :primary_key option, so need
11
9
  # to test this association manually
@@ -34,12 +32,12 @@ describe Mdm::Module::Ref do
34
32
 
35
33
  context 'database' do
36
34
  context 'columns' do
37
- it { should have_db_column(:detail_id).of_type(:integer) }
38
- it { should have_db_column(:name) }
35
+ it { is_expected.to have_db_column(:detail_id).of_type(:integer) }
36
+ it { is_expected.to have_db_column(:name) }
39
37
  end
40
38
 
41
39
  context 'indices' do
42
- it { should have_db_column(:detail_id) }
40
+ it { is_expected.to have_db_column(:detail_id) }
43
41
  end
44
42
  end
45
43
 
@@ -49,17 +47,17 @@ describe Mdm::Module::Ref do
49
47
  FactoryGirl.build :mdm_module_ref
50
48
  end
51
49
 
52
- it { should be_valid }
50
+ it { is_expected.to be_valid }
53
51
  end
54
52
  end
55
53
 
56
54
  context 'mass assignment security' do
57
- it { should_not allow_mass_assignment_of(:detail_id) }
58
- it { should allow_mass_assignment_of(:name) }
55
+ it { is_expected.not_to allow_mass_assignment_of(:detail_id) }
56
+ it { is_expected.to allow_mass_assignment_of(:name) }
59
57
  end
60
58
 
61
59
  context 'validations' do
62
- it { should validate_presence_of(:detail) }
63
- it { should validate_presence_of(:name) }
60
+ it { is_expected.to validate_presence_of(:detail) }
61
+ it { is_expected.to validate_presence_of(:name) }
64
62
  end
65
63
  end
@@ -1,22 +1,20 @@
1
- require 'spec_helper'
2
-
3
- describe Mdm::Module::Target do
1
+ RSpec.describe Mdm::Module::Target, type: :model do
4
2
 
5
3
  it_should_behave_like 'Metasploit::Concern.run'
6
4
 
7
5
  context 'associations' do
8
- it { should belong_to(:detail).class_name('Mdm::Module::Detail') }
6
+ it { is_expected.to belong_to(:detail).class_name('Mdm::Module::Detail') }
9
7
  end
10
8
 
11
9
  context 'database' do
12
10
  context 'columns' do
13
- it { should have_db_column(:detail_id).of_type(:integer) }
14
- it { should have_db_column(:index).of_type(:integer) }
15
- it { should have_db_column(:name).of_type(:text) }
11
+ it { is_expected.to have_db_column(:detail_id).of_type(:integer) }
12
+ it { is_expected.to have_db_column(:index).of_type(:integer) }
13
+ it { is_expected.to have_db_column(:name).of_type(:text) }
16
14
  end
17
15
 
18
16
  context 'indices' do
19
- it { should have_db_index(:detail_id) }
17
+ it { is_expected.to have_db_index(:detail_id) }
20
18
  end
21
19
  end
22
20
 
@@ -26,19 +24,19 @@ describe Mdm::Module::Target do
26
24
  FactoryGirl.build :mdm_module_target
27
25
  end
28
26
 
29
- it { should be_valid }
27
+ it { is_expected.to be_valid }
30
28
  end
31
29
  end
32
30
 
33
31
  context 'mass assignment security' do
34
- it { should_not allow_mass_assignment_of(:detail_id) }
35
- it { should allow_mass_assignment_of(:index) }
36
- it { should allow_mass_assignment_of(:name) }
32
+ it { is_expected.not_to allow_mass_assignment_of(:detail_id) }
33
+ it { is_expected.to allow_mass_assignment_of(:index) }
34
+ it { is_expected.to allow_mass_assignment_of(:name) }
37
35
  end
38
36
 
39
37
  context 'validations' do
40
- it { should validate_presence_of(:detail) }
41
- it { should validate_presence_of(:index) }
42
- it { should validate_presence_of(:name) }
38
+ it { is_expected.to validate_presence_of(:detail) }
39
+ it { is_expected.to validate_presence_of(:index) }
40
+ it { is_expected.to validate_presence_of(:name) }
43
41
  end
44
42
  end
@@ -1,34 +1,32 @@
1
- require 'spec_helper'
2
-
3
- describe Mdm::NexposeConsole do
1
+ RSpec.describe Mdm::NexposeConsole, type: :model do
4
2
  it_should_behave_like 'Metasploit::Concern.run'
5
3
 
6
4
  context 'factory' do
7
5
  it 'should be valid' do
8
6
  nexpose_console = FactoryGirl.build(:mdm_nexpose_console)
9
- nexpose_console.should be_valid
7
+ expect(nexpose_console).to be_valid
10
8
  end
11
9
  end
12
10
 
13
11
  context 'database' do
14
12
 
15
13
  context 'timestamps'do
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) }
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) }
18
16
  end
19
17
 
20
18
  context 'columns' do
21
- it { should have_db_column(:enabled).of_type(:boolean).with_options(:default => true) }
22
- it { should have_db_column(:owner).of_type(:text) }
23
- it { should have_db_column(:address).of_type(:text) }
24
- it { should have_db_column(:port).of_type(:integer).with_options(:default => 3780) }
25
- it { should have_db_column(:username).of_type(:text) }
26
- it { should have_db_column(:password).of_type(:text) }
27
- it { should have_db_column(:status).of_type(:text) }
28
- it { should have_db_column(:version).of_type(:text) }
29
- it { should have_db_column(:cert).of_type(:text) }
30
- it { should have_db_column(:cached_sites).of_type(:binary) }
31
- it { should have_db_column(:name).of_type(:text) }
19
+ it { is_expected.to have_db_column(:enabled).of_type(:boolean).with_options(:default => true) }
20
+ it { is_expected.to have_db_column(:owner).of_type(:text) }
21
+ it { is_expected.to have_db_column(:address).of_type(:text) }
22
+ it { is_expected.to have_db_column(:port).of_type(:integer).with_options(:default => 3780) }
23
+ it { is_expected.to have_db_column(:username).of_type(:text) }
24
+ it { is_expected.to have_db_column(:password).of_type(:text) }
25
+ it { is_expected.to have_db_column(:status).of_type(:text) }
26
+ it { is_expected.to have_db_column(:version).of_type(:text) }
27
+ it { is_expected.to have_db_column(:cert).of_type(:text) }
28
+ it { is_expected.to have_db_column(:cached_sites).of_type(:binary) }
29
+ it { is_expected.to have_db_column(:name).of_type(:text) }
32
30
  end
33
31
  end
34
32
 
@@ -48,74 +46,74 @@ describe Mdm::NexposeConsole do
48
46
  context 'address' do
49
47
  it 'should require an address' do
50
48
  addressless_nexpose_console = FactoryGirl.build(:mdm_nexpose_console, :address => nil)
51
- addressless_nexpose_console.should_not be_valid
52
- addressless_nexpose_console.errors[:address].should include("can't be blank")
49
+ expect(addressless_nexpose_console).not_to be_valid
50
+ expect(addressless_nexpose_console.errors[:address]).to include("can't be blank")
53
51
  end
54
52
 
55
53
  it 'should be valid for IPv4 format' do
56
54
  ipv4_nexpose_console = FactoryGirl.build(:mdm_nexpose_console, :address => '192.168.1.120')
57
- ipv4_nexpose_console.should be_valid
55
+ expect(ipv4_nexpose_console).to be_valid
58
56
  end
59
57
 
60
58
  it 'should be valid for IPv6 format' do
61
59
  ipv6_nexpose_console = FactoryGirl.build(:mdm_nexpose_console, :address => '2001:0db8:85a3:0000:0000:8a2e:0370:7334')
62
- ipv6_nexpose_console.should be_valid
60
+ expect(ipv6_nexpose_console).to be_valid
63
61
  end
64
62
  end
65
63
 
66
64
  context 'port' do
67
65
  it 'should require a port' do
68
66
  portless_nexpose_console = FactoryGirl.build(:mdm_nexpose_console, :port => nil)
69
- portless_nexpose_console.should_not be_valid
70
- portless_nexpose_console.errors[:port].should include("is not included in the list")
67
+ expect(portless_nexpose_console).not_to be_valid
68
+ expect(portless_nexpose_console.errors[:port]).to include("is not included in the list")
71
69
  end
72
70
 
73
71
  it 'should not be valid for out-of-range numbers' do
74
72
  out_of_range = FactoryGirl.build(:mdm_nexpose_console, :port => 70000)
75
- out_of_range.should_not be_valid
76
- out_of_range.errors[:port].should include("is not included in the list")
73
+ expect(out_of_range).not_to be_valid
74
+ expect(out_of_range.errors[:port]).to include("is not included in the list")
77
75
  end
78
76
 
79
77
  it 'should not be valid for port 0' do
80
78
  out_of_range = FactoryGirl.build(:mdm_nexpose_console, :port => 0)
81
- out_of_range.should_not be_valid
82
- out_of_range.errors[:port].should include("is not included in the list")
79
+ expect(out_of_range).not_to be_valid
80
+ expect(out_of_range.errors[:port]).to include("is not included in the list")
83
81
  end
84
82
 
85
83
  it 'should not be valid for decimal numbers' do
86
84
  out_of_range = FactoryGirl.build(:mdm_nexpose_console, :port => 5.67)
87
- out_of_range.should_not be_valid
88
- out_of_range.errors[:port].should include("must be an integer")
85
+ expect(out_of_range).not_to be_valid
86
+ expect(out_of_range.errors[:port]).to include("must be an integer")
89
87
  end
90
88
 
91
89
  it 'should not be valid for a negative number' do
92
90
  out_of_range = FactoryGirl.build(:mdm_nexpose_console, :port => -8)
93
- out_of_range.should_not be_valid
94
- out_of_range.errors[:port].should include("is not included in the list")
91
+ expect(out_of_range).not_to be_valid
92
+ expect(out_of_range.errors[:port]).to include("is not included in the list")
95
93
  end
96
94
  end
97
95
 
98
96
  context 'name' do
99
97
  it 'should require a name' do
100
98
  unnamed_console = FactoryGirl.build(:mdm_nexpose_console, :name => nil)
101
- unnamed_console.should_not be_valid
102
- unnamed_console.errors[:name].should include("can't be blank")
99
+ expect(unnamed_console).not_to be_valid
100
+ expect(unnamed_console.errors[:name]).to include("can't be blank")
103
101
  end
104
102
  end
105
103
 
106
104
  context 'username' do
107
105
  it 'should require a name' do
108
106
  console = FactoryGirl.build(:mdm_nexpose_console, :username => nil)
109
- console.should_not be_valid
110
- console.errors[:username].should include("can't be blank")
107
+ expect(console).not_to be_valid
108
+ expect(console.errors[:username]).to include("can't be blank")
111
109
  end
112
110
  end
113
111
 
114
112
  context 'password' do
115
113
  it 'should require a password' do
116
114
  console = FactoryGirl.build(:mdm_nexpose_console, :password => nil)
117
- console.should_not be_valid
118
- console.errors[:password].should include("can't be blank")
115
+ expect(console).not_to be_valid
116
+ expect(console.errors[:password]).to include("can't be blank")
119
117
  end
120
118
  end
121
119
 
@@ -1,31 +1,29 @@
1
- require 'spec_helper'
2
-
3
- describe Mdm::Note do
1
+ RSpec.describe Mdm::Note, type: :model do
4
2
  it_should_behave_like 'Metasploit::Concern.run'
5
3
 
6
4
  context 'factory' do
7
5
  it 'should be valid' do
8
6
  note = FactoryGirl.build(:mdm_note)
9
- note.should be_valid
7
+ expect(note).to be_valid
10
8
  end
11
9
  end
12
10
 
13
11
  context 'database' do
14
12
 
15
13
  context 'timestamps'do
16
- it { should have_db_column(:created_at).of_type(:datetime) }
17
- it { should have_db_column(:updated_at).of_type(:datetime) }
14
+ it { is_expected.to have_db_column(:created_at).of_type(:datetime) }
15
+ it { is_expected.to have_db_column(:updated_at).of_type(:datetime) }
18
16
  end
19
17
 
20
18
  context 'columns' do
21
- it { should have_db_column(:workspace_id).of_type(:integer).with_options(:null => false, :default =>1) }
22
- it { should have_db_column(:host_id).of_type(:integer) }
23
- it { should have_db_column(:service_id).of_type(:integer) }
24
- it { should have_db_column(:vuln_id).of_type(:integer) }
25
- it { should have_db_column(:ntype).of_type(:string) }
26
- it { should have_db_column(:critical).of_type(:boolean) }
27
- it { should have_db_column(:seen).of_type(:boolean) }
28
- it { should have_db_column(:data).of_type(:text) }
19
+ it { is_expected.to have_db_column(:workspace_id).of_type(:integer).with_options(:null => false, :default =>1) }
20
+ it { is_expected.to have_db_column(:host_id).of_type(:integer) }
21
+ it { is_expected.to have_db_column(:service_id).of_type(:integer) }
22
+ it { is_expected.to have_db_column(:vuln_id).of_type(:integer) }
23
+ it { is_expected.to have_db_column(:ntype).of_type(:string) }
24
+ it { is_expected.to have_db_column(:critical).of_type(:boolean) }
25
+ it { is_expected.to have_db_column(:seen).of_type(:boolean) }
26
+ it { is_expected.to have_db_column(:data).of_type(:text) }
29
27
  end
30
28
  end
31
29
 
@@ -42,10 +40,10 @@ describe Mdm::Note do
42
40
  end
43
41
 
44
42
  context 'associations' do
45
- it { should belong_to(:workspace).class_name('Mdm::Workspace') }
46
- it { should belong_to(:host).class_name('Mdm::Host') }
47
- it { should belong_to(:service).class_name('Mdm::Service') }
48
- it { should belong_to(:vuln).class_name('Mdm::Vuln') }
43
+ it { is_expected.to belong_to(:workspace).class_name('Mdm::Workspace') }
44
+ it { is_expected.to belong_to(:host).class_name('Mdm::Host') }
45
+ it { is_expected.to belong_to(:service).class_name('Mdm::Service') }
46
+ it { is_expected.to belong_to(:vuln).class_name('Mdm::Vuln') }
49
47
  end
50
48
 
51
49
  context 'scopes' do
@@ -54,16 +52,16 @@ describe Mdm::Note do
54
52
  flagged_note = FactoryGirl.create(:mdm_note, :critical => true, :seen => false)
55
53
  non_critical_note = FactoryGirl.create(:mdm_note, :critical => false, :seen => false)
56
54
  flagged_set = Mdm::Note.flagged
57
- flagged_set.should include(flagged_note)
58
- flagged_set.should_not include(non_critical_note)
55
+ expect(flagged_set).to include(flagged_note)
56
+ expect(flagged_set).not_to include(non_critical_note)
59
57
  end
60
58
 
61
59
  it 'should exclude seen notes' do
62
60
  flagged_note = FactoryGirl.create(:mdm_note, :critical => true, :seen => false)
63
61
  non_critical_note = FactoryGirl.create(:mdm_note, :critical => false, :seen => true)
64
62
  flagged_set = Mdm::Note.flagged
65
- flagged_set.should include(flagged_note)
66
- flagged_set.should_not include(non_critical_note)
63
+ expect(flagged_set).to include(flagged_note)
64
+ expect(flagged_set).not_to include(non_critical_note)
67
65
  end
68
66
  end
69
67
 
@@ -72,15 +70,15 @@ describe Mdm::Note do
72
70
  flagged_note = FactoryGirl.create(:mdm_note, :ntype => 'flag.me', :critical => true, :seen => false)
73
71
  webform_note = FactoryGirl.create(:mdm_note, :ntype => 'web.form', :critical => true, :seen => false)
74
72
  visible_set = Mdm::Note.visible
75
- visible_set.should include(flagged_note)
76
- visible_set.should_not include(webform_note)
73
+ expect(visible_set).to include(flagged_note)
74
+ expect(visible_set).not_to include(webform_note)
77
75
  end
78
76
  end
79
77
 
80
78
  context 'search' do
81
79
  it 'should match on ntype' do
82
80
  flagged_note = FactoryGirl.create(:mdm_note, :ntype => 'flag.me', :critical => true, :seen => false)
83
- Mdm::Note.search('flag.me').should include(flagged_note)
81
+ expect(Mdm::Note.search('flag.me')).to include(flagged_note)
84
82
  end
85
83
  end
86
84
  end