From 8b44354fec89b7b56425ca0182fe7fce9f61d2b9 Mon Sep 17 00:00:00 2001 From: erwanlr Date: Fri, 12 Sep 2014 20:47:47 +0200 Subject: [PATCH] Fixes travis failure --- spec/shared_examples/wp_target/malwares.rb | 8 ++-- spec/xml_checks_spec.rb | 52 ---------------------- 2 files changed, 5 insertions(+), 55 deletions(-) delete mode 100644 spec/xml_checks_spec.rb diff --git a/spec/shared_examples/wp_target/malwares.rb b/spec/shared_examples/wp_target/malwares.rb index 4c295cc7..b4aabccf 100644 --- a/spec/shared_examples/wp_target/malwares.rb +++ b/spec/shared_examples/wp_target/malwares.rb @@ -6,7 +6,7 @@ shared_examples 'WpTarget::Malwares' do let(:malwares_file) { fixtures_dir + '/malwares.txt' } describe '#malwares_file' do - it "returns the correct file path" do + it 'returns the correct file path' do expect(WpTarget::Malwares.malwares_file(malwares_file)).to be === malwares_file end end @@ -14,10 +14,12 @@ shared_examples 'WpTarget::Malwares' do describe '#malwares & #has_malwares' do after :each do if @fixture - stub_request_to_fixture(url: wp_target.url, fixture: File.new(fixtures_dir + @fixture)) + stub_request_to_fixture( + url: wp_target.url, fixture: File.new(File.join(fixtures_dir, @fixture)) + ) end - malwares = wp_target.malwares(@malwares_file_path) + malwares = wp_target.malwares(malwares_file) expect(malwares.sort).to be === @expected.sort expect(wp_target.has_malwares?).to be === (@expected.empty? ? false : true) diff --git a/spec/xml_checks_spec.rb b/spec/xml_checks_spec.rb deleted file mode 100644 index bdc68691..00000000 --- a/spec/xml_checks_spec.rb +++ /dev/null @@ -1,52 +0,0 @@ -# encoding: UTF-8 - -require 'spec_helper' - -describe 'XSD checks' do - - after :each do - expect(FileTest.exists?(@file)).to be_truthy - - xsd = Nokogiri::XML::Schema(File.read(@xsd)) - doc = Nokogiri::XML(File.read(@file)) - - errors = [] - xsd.validate(doc).each do |error| - errors << "#{@file}:#{error.line}: #{error.message}" - end - - unless errors.empty? - fail errors.join("\n") - end - end - - it 'check wp_versions.xml for syntax errors' do - @file = WP_VERSIONS_FILE - @xsd = WP_VERSIONS_XSD - end - - it 'check local_vulnerable_files.xml for syntax errors' do - @file = LOCAL_FILES_FILE - @xsd = LOCAL_FILES_XSD - end -end - -describe 'Well formed XML checks' do - after :each do - expect(FileTest.exists?(@file)).to be_truthy - - begin - Nokogiri::XML(File.open(@file)) { |config| config.options = Nokogiri::XML::ParseOptions::STRICT } - rescue Nokogiri::XML::SyntaxError => e - fail "#{@file}:#{e.line},#{e.column}: #{e.message}" - end - end - - it 'check wp_versions.xml for syntax errors' do - @file = WP_VERSIONS_FILE - end - - it 'check local_vulnerable_files.xml for syntax errors' do - @file = LOCAL_FILES_FILE - end -end