Skip to content

Commit 1df08cf

Browse files
committed
Add specs to prevent dupe migrations_paths regression
[#50099107] Add specs to verify that the duplicate migrations_paths protection works.
1 parent 28e08ae commit 1df08cf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

spec/lib/msf/db_manager_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@
2020

2121
it_should_behave_like 'Msf::DBManager::ImportMsfXml'
2222

23+
context '#initialize_metasploit_data_models' do
24+
def initialize_metasploit_data_models
25+
db_manager.initialize_metasploit_data_models
26+
end
27+
28+
it 'should not add duplicate paths to ActiveRecord::Migrator.migrations_paths' do
29+
initialize_metasploit_data_models
30+
31+
expect {
32+
initialize_metasploit_data_models
33+
}.to_not change {
34+
ActiveRecord::Migrator.migrations_paths.length
35+
}
36+
37+
ActiveRecord::Migrator.migrations_paths.uniq.should == ActiveRecord::Migrator.migrations_paths
38+
end
39+
end
40+
2341
context '#purge_all_module_details' do
2442
def purge_all_module_details
2543
db_manager.purge_all_module_details

0 commit comments

Comments
 (0)