Skip to content

Commit 94fa6a3

Browse files
committed
Fix strip_whitespace speccing
1 parent 48a5123 commit 94fa6a3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spec/lib/msf/core/exploit/powershell_spec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def decompress(code)
7878

7979
context 'when strip_whitespace is true' do
8080
before do
81+
subject.datastore['Powershell::strip_comments'] = false
8182
subject.datastore['Powershell::strip_whitespace'] = true
8283
subject.options.validate(subject.datastore)
8384
end
@@ -90,13 +91,16 @@ def decompress(code)
9091

9192
context 'when strip_whitespace is false' do
9293
before do
94+
subject.datastore['Powershell::strip_comments'] = false
9395
subject.datastore['Powershell::strip_whitespace'] = false
9496
subject.options.validate(subject.datastore)
9597
end
9698
it 'shouldnt strip whitespace' do
9799
script = File.read(example_script)
100+
File.open('/tmp/1','w') { |f| f.write script }
98101
compressed = subject.compress_script(script)
99-
decompress(compressed).length.should be script.length
102+
File.open('/tmp/2','w') { |f| f.write decompress(compressed) }
103+
expect(decompress(compressed).length).to eq(script.length)
100104
end
101105
end
102106

0 commit comments

Comments
 (0)