@@ -80,47 +80,67 @@ def module_info_by_path
80
80
mock ( 'Msf::Modules::Namespace' , :parent_path => parent_path )
81
81
end
82
82
83
- it 'should update module_info_by_path' do
84
- expect {
85
- cache_in_memory
86
- } . to change { module_info_by_path }
87
- end
88
-
89
- context 'module_info_by_path' do
90
- subject ( :module_info_by_path ) do
91
- module_manager . send ( :module_info_by_path )
92
- end
93
-
94
- before ( :each ) do
95
- cache_in_memory
96
- end
97
-
98
- it 'should have entry for path' do
99
- module_info_by_path [ path ] . should be_a Hash
83
+ context 'with existing :path' do
84
+ it 'should update module_info_by_path' do
85
+ expect {
86
+ cache_in_memory
87
+ } . to change { module_info_by_path }
100
88
end
101
89
102
- context 'value ' do
103
- subject ( :value ) do
104
- module_info_by_path [ path ]
90
+ context 'module_info_by_path ' do
91
+ subject ( :module_info_by_path ) do
92
+ module_manager . send ( : module_info_by_path)
105
93
end
106
94
107
- it 'should have modification time of :path option for :modification_time' do
108
- value [ :modification_time ] . should == pathname_modification_time
95
+ before ( :each ) do
96
+ cache_in_memory
109
97
end
110
98
111
- it 'should have parent path from namespace module for :parent_path ' do
112
- value [ :parent_path ] . should == namespace_module . parent_path
99
+ it 'should have entry for path ' do
100
+ module_info_by_path [ path ] . should be_a Hash
113
101
end
114
102
115
- it 'should use :reference_name option' do
116
- value [ :reference_name ] . should == reference_name
117
- end
103
+ context 'value' do
104
+ subject ( :value ) do
105
+ module_info_by_path [ path ]
106
+ end
107
+
108
+ it 'should have modification time of :path option for :modification_time' do
109
+ value [ :modification_time ] . should == pathname_modification_time
110
+ end
118
111
119
- it 'should use :type option' do
120
- value [ :type ] . should == type
112
+ it 'should have parent path from namespace module for :parent_path' do
113
+ value [ :parent_path ] . should == namespace_module . parent_path
114
+ end
115
+
116
+ it 'should use :reference_name option' do
117
+ value [ :reference_name ] . should == reference_name
118
+ end
119
+
120
+ it 'should use :type option' do
121
+ value [ :type ] . should == type
122
+ end
121
123
end
122
124
end
123
125
end
126
+
127
+ context 'without existing :path' do
128
+ let ( :path ) do
129
+ 'non/existent/path'
130
+ end
131
+
132
+ it 'should not raise error' do
133
+ expect {
134
+ cache_in_memory
135
+ } . to_not raise_error
136
+ end
137
+
138
+ it 'should not update module_info_by_path' do
139
+ expect {
140
+ cache_in_memory
141
+ } . to_not change { module_info_by_path }
142
+ end
143
+ end
124
144
end
125
145
126
146
context '#load_cached_module' do
0 commit comments