Merge pull request #2 from dctabuyz/useActualRubyVersion

use actual ruby interpreter
This commit is contained in:
dctabuyz
2015-01-07 14:03:54 +05:00

View File

@@ -5,14 +5,14 @@ require 'spec_helper'
describe 'wpscan main checks' do describe 'wpscan main checks' do
it 'should check for errors on running the mainscript' do it 'should check for errors on running the mainscript' do
a = %x[ruby #{ROOT_DIR}/wpscan.rb] a = %x[#{RbConfig.ruby} #{ROOT_DIR}/wpscan.rb]
expect(a).to match /No argument supplied/ expect(a).to match /No argument supplied/
end end
it 'should check for valid syntax' do it 'should check for valid syntax' do
result = "" result = ""
Dir.glob("**/*.rb") do |file| Dir.glob("**/*.rb") do |file|
res = %x{ruby -c #{ROOT_DIR}/#{file} 2>&1}.split("\n") res = %x{#{RbConfig.ruby} -c #{ROOT_DIR}/#{file} 2>&1}.split("\n")
ok = res.select {|msg| msg =~ /Syntax OK/} ok = res.select {|msg| msg =~ /Syntax OK/}
result << ("####################\nSyntax error in #{file}:\n#{res.join("\n").strip()}\n") if ok.size != 1 result << ("####################\nSyntax error in #{file}:\n#{res.join("\n").strip()}\n") if ok.size != 1
end end