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

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2018-07-18 15:06:53 +02:00
parent d81189029d
commit d2db7d40dd
No known key found for this signature in database
GPG Key ID: 98DFFD1C0C62B70B
11 changed files with 14 additions and 14 deletions

View File

@ -59,7 +59,7 @@ module QA
end
def add_file(name, contents)
File.write(name, contents)
::File.write(name, contents)
`git add #{name}`
end

View File

@ -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)

View File

@ -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?('?') ? '&' : '?')

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -1,6 +1,6 @@
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|