Commit d2db7d40 authored by Rémy Coutable's avatar Rémy Coutable

Disambiguate 'File' under qa/ since we have a QA::Factory::Resource::File class as well

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent d8118902
......@@ -59,7 +59,7 @@ module QA
end
def add_file(name, contents)
File.write(name, contents)
::File.write(name, contents)
`git add #{name}`
end
......
......@@ -15,7 +15,7 @@ module QA
# instantiated on one page because there is no distinguishing
# attribute per dropzone file field.
def attach_file(attachment)
filename = File.basename(attachment)
filename = ::File.basename(attachment)
field_style = { visibility: 'visible', height: '', width: '' }
page.attach_file(attachment, class: 'dz-hidden-input', make_visible: field_style)
......
......@@ -28,7 +28,7 @@ module QA
#
# Returns the relative path to the requested API resource
def request_path(path, version: API_VERSION, **query_string)
full_path = File.join('/api', version, path)
full_path = ::File.join('/api', version, path)
if query_string.any?
full_path << (path.include?('?') ? '&' : '?')
......
......@@ -86,7 +86,7 @@ module QA
end
Capybara::Screenshot.register_filename_prefix_formatter(:rspec) do |example|
File.join(QA::Runtime::Namespace.name, example.file_path.sub('./qa/specs/features/', ''))
::File.join(QA::Runtime::Namespace.name, example.file_path.sub('./qa/specs/features/', ''))
end
Capybara.configure do |config|
......@@ -94,7 +94,7 @@ module QA
config.javascript_driver = :chrome
config.default_max_wait_time = 10
# https://github.com/mattheworiordan/capybara-screenshot/issues/164
config.save_path = File.expand_path('../../tmp', __dir__)
config.save_path = ::File.expand_path('../../tmp', __dir__)
end
end
......
......@@ -25,8 +25,8 @@ module QA
end
def populate_key_data(path)
@private_key = File.binread(path)
@public_key = File.binread("#{path}.pub")
@private_key = ::File.binread(path)
@public_key = ::File.binread("#{path}.pub")
@fingerprint =
`ssh-keygen -l -E md5 -f #{path} | cut -d' ' -f2 | cut -d: -f2-`.chomp
end
......
......@@ -13,7 +13,7 @@ module QA
end
def version
@version ||= File.directory?("#{__dir__}/../ee") ? :EE : :CE
@version ||= ::File.directory?("#{__dir__}/../ee") ? :EE : :CE
end
def strategy
......
......@@ -26,7 +26,7 @@ module QA
if rspec_options.any?
rspec_options
else
File.expand_path('../../specs/features', __dir__)
::File.expand_path('../../specs/features', __dir__)
end
end
end
......
......@@ -29,7 +29,7 @@ describe QA::Git::Repository do
def cd_empty_temp_directory
tmp_dir = 'tmp/git-repository-spec/'
FileUtils.rm_r(tmp_dir) if File.exist?(tmp_dir)
FileUtils.rm_r(tmp_dir) if ::File.exist?(tmp_dir)
FileUtils.mkdir_p tmp_dir
FileUtils.cd tmp_dir
end
......
......@@ -32,7 +32,7 @@ describe QA::Page::View do
context 'when pattern is found' do
before do
allow(File).to receive(:foreach)
allow(::File).to receive(:foreach)
.and_yield('some element').once
allow(element).to receive(:matches?)
.with('some element').and_return(true)
......@@ -45,7 +45,7 @@ describe QA::Page::View do
context 'when pattern has not been found' do
before do
allow(File).to receive(:foreach)
allow(::File).to receive(:foreach)
.and_yield('some element').once
allow(element).to receive(:matches?)
.with('some element').and_return(false)
......
......@@ -30,7 +30,7 @@ describe QA::Scenario::Test::Instance do
subject.perform("test")
expect(runner).to have_received(:options=)
.with(File.expand_path('../../../qa/specs/features', __dir__))
.with(::File.expand_path('../../../qa/specs/features', __dir__))
end
end
......
require_relative '../qa'
Dir[File.join(__dir__, 'support', '**', '*.rb')].each { |f| require f }
Dir[::File.join(__dir__, 'support', '**', '*.rb')].each { |f| require f }
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment