Skip to content

Commit d402b3f

Browse files
committed
Merge branch 'bug/wrong-file_changed-argument' of github.com:rapid7/metasploit-framework into bug/wrong-file_changed-argument
2 parents 2f41452 + 5709ffc commit d402b3f

File tree

3 files changed

+11
-36
lines changed

3 files changed

+11
-36
lines changed

lib/msf/core.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,6 @@
1919

2020
module Msf
2121
LogSource = "core"
22-
23-
# Returns Pathname of the root of the Metasploit Framework source
24-
#
25-
# @return [Pathname] root directory above lib, data, modules, etc.
26-
def self.root
27-
unless instance_variable_defined? :@root
28-
msf_pathname = Pathname.new(__FILE__).dirname
29-
lib_pathname = msf_pathname.parent
30-
31-
@root = lib_pathname.parent
32-
end
33-
34-
@root
35-
end
3622
end
3723

3824
# General

spec/lib/msf/core/modules/loader/base_spec.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
require 'msf/core'
44

55
describe Msf::Modules::Loader::Base do
6+
let(:described_class_pathname) do
7+
root_pathname.join('lib', 'msf', 'core', 'modules', 'loader', 'base.rb')
8+
end
9+
610
let(:malformed_module_content) do
711
<<-EOS
812
class Metasploit3
@@ -38,17 +42,18 @@ class Metasploit3 < Msf::Auxiliary
3842
end
3943

4044
let(:parent_pathname) do
41-
Msf.root.join('modules')
45+
root_pathname.join('modules')
46+
end
47+
48+
let(:root_pathname) do
49+
Pathname.new(Msf::Config.install_root)
4250
end
4351

4452
let(:type) do
4553
Msf::MODULE_AUX
4654
end
4755

4856
context 'CONSTANTS' do
49-
let(:pathname) do
50-
Msf.root.join('lib', 'msf', 'core', 'modules', 'loader', 'base.rb')
51-
end
5257

5358
context 'DIRECTORY_BY_TYPE' do
5459
let(:directory_by_type) do
@@ -88,7 +93,7 @@ class Metasploit3 < Msf::Auxiliary
8893
it 'should be line number for first line of NAMESPACE_MODULE_CONTENT' do
8994
file_lines = []
9095

91-
pathname.open do |f|
96+
described_class_pathname.open do |f|
9297
file_lines = f.to_a
9398
end
9499

@@ -820,7 +825,7 @@ class Metasploit3 < Msf::Auxiliary
820825
:module_eval
821826
).with(
822827
anything,
823-
Msf.root.join('lib', 'msf', 'core', 'modules', 'loader', 'base.rb').to_s,
828+
described_class_pathname.to_s,
824829
anything
825830
)
826831

spec/lib/msf/core_spec.rb

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)