Uses Pathname#join rather than File#join when possible

This commit is contained in:
erwanlr
2019-02-11 19:30:49 +00:00
parent cdc1dab4a6
commit 7a0f98b2cb
64 changed files with 118 additions and 118 deletions

View File

@@ -1,6 +1,6 @@
shared_examples WPScan::Finders::DynamicFinder::WpItems::Finder do
let(:passive_fixture) do
File.join(fixtures, "#{described_class.to_s.demodulize.underscore}_passive_all.html")
fixtures.join("#{described_class.to_s.demodulize.underscore}_passive_all.html")
end
describe '#passive_configs' do
@@ -69,7 +69,7 @@ shared_examples WPScan::Finders::DynamicFinder::WpItems::Finder do
configs.each do |finder_class, config|
finder_super_class = config['class'] || finder_class
fixture = File.join(fixtures, slug, finder_class.underscore, config['path'])
fixture = fixtures.join(slug, finder_class.underscore, config['path'])
stubbed_response = df_stubbed_response(fixture, finder_super_class)
path = finder.aggressive_path(slug, config)

View File

@@ -1,6 +1,6 @@
shared_examples 'App::Finders::WpItems::URLsInHomepage' do
before do
stub_request(:get, finder.target.url).to_return(body: File.read(File.join(fixtures, file)))
stub_request(:get, finder.target.url).to_return(body: File.read(fixtures.join(file)))
end
describe '#items_from_links' do

View File

@@ -1,5 +1,5 @@
shared_examples 'WordPress::CustomDirectories' do
let(:fixtures) { File.join(super(), 'custom_directories') }
let(:fixtures) { super().join('custom_directories') }
describe '#content_dir' do
{
@@ -7,9 +7,7 @@ shared_examples 'WordPress::CustomDirectories' do
relative_one: 'wp-content', relative_two: 'wp-content', cache: 'wp-content'
}.each do |file, expected|
it "returns #{expected} for #{file}.html" do
fixture = File.join(fixtures, "#{file}.html")
stub_request(:get, target.url).to_return(body: File.read(fixture))
stub_request(:get, target.url).to_return(body: File.read(fixtures.join("#{file}.html")))
expect(target.content_dir).to eql expected
end

View File

@@ -21,7 +21,7 @@ shared_examples 'App::Views::MainTheme' do
expect(target).to receive(:content_dir).at_least(1).and_return('wp-content')
stub_request(:get, /.*/)
stub_request(:get, /.*\.css\z/)
.to_return(body: File.read(File.join(FIXTURES, 'models', 'theme', 'style.css')))
.to_return(body: File.read(FIXTURES.join('models', 'theme', 'style.css')))
end
context 'when no verbose' do