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 ...@@ -59,7 +59,7 @@ module QA
end end
def add_file(name, contents) def add_file(name, contents)
File.write(name, contents) ::File.write(name, contents)
`git add #{name}` `git add #{name}`
end end
......
...@@ -15,7 +15,7 @@ module QA ...@@ -15,7 +15,7 @@ module QA
# instantiated on one page because there is no distinguishing # instantiated on one page because there is no distinguishing
# attribute per dropzone file field. # attribute per dropzone file field.
def attach_file(attachment) def attach_file(attachment)
filename = File.basename(attachment) filename = ::File.basename(attachment)
field_style = { visibility: 'visible', height: '', width: '' } field_style = { visibility: 'visible', height: '', width: '' }
page.attach_file(attachment, class: 'dz-hidden-input', make_visible: field_style) page.attach_file(attachment, class: 'dz-hidden-input', make_visible: field_style)
......
...@@ -28,7 +28,7 @@ module QA ...@@ -28,7 +28,7 @@ module QA
# #
# Returns the relative path to the requested API resource # Returns the relative path to the requested API resource
def request_path(path, version: API_VERSION, **query_string) 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? if query_string.any?
full_path << (path.include?('?') ? '&' : '?') full_path << (path.include?('?') ? '&' : '?')
......
...@@ -86,7 +86,7 @@ module QA ...@@ -86,7 +86,7 @@ module QA
end end
Capybara::Screenshot.register_filename_prefix_formatter(:rspec) do |example| 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 end
Capybara.configure do |config| Capybara.configure do |config|
...@@ -94,7 +94,7 @@ module QA ...@@ -94,7 +94,7 @@ module QA
config.javascript_driver = :chrome config.javascript_driver = :chrome
config.default_max_wait_time = 10 config.default_max_wait_time = 10
# https://github.com/mattheworiordan/capybara-screenshot/issues/164 # 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
end end
......
...@@ -25,8 +25,8 @@ module QA ...@@ -25,8 +25,8 @@ module QA
end end
def populate_key_data(path) def populate_key_data(path)
@private_key = File.binread(path) @private_key = ::File.binread(path)
@public_key = File.binread("#{path}.pub") @public_key = ::File.binread("#{path}.pub")
@fingerprint = @fingerprint =
`ssh-keygen -l -E md5 -f #{path} | cut -d' ' -f2 | cut -d: -f2-`.chomp `ssh-keygen -l -E md5 -f #{path} | cut -d' ' -f2 | cut -d: -f2-`.chomp
end end
......
...@@ -13,7 +13,7 @@ module QA ...@@ -13,7 +13,7 @@ module QA
end end
def version def version
@version ||= File.directory?("#{__dir__}/../ee") ? :EE : :CE @version ||= ::File.directory?("#{__dir__}/../ee") ? :EE : :CE
end end
def strategy def strategy
......
...@@ -26,7 +26,7 @@ module QA ...@@ -26,7 +26,7 @@ module QA
if rspec_options.any? if rspec_options.any?
rspec_options rspec_options
else else
File.expand_path('../../specs/features', __dir__) ::File.expand_path('../../specs/features', __dir__)
end end
end end
end end
......
...@@ -29,7 +29,7 @@ describe QA::Git::Repository do ...@@ -29,7 +29,7 @@ describe QA::Git::Repository do
def cd_empty_temp_directory def cd_empty_temp_directory
tmp_dir = 'tmp/git-repository-spec/' 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.mkdir_p tmp_dir
FileUtils.cd tmp_dir FileUtils.cd tmp_dir
end end
......
...@@ -32,7 +32,7 @@ describe QA::Page::View do ...@@ -32,7 +32,7 @@ describe QA::Page::View do
context 'when pattern is found' do context 'when pattern is found' do
before do before do
allow(File).to receive(:foreach) allow(::File).to receive(:foreach)
.and_yield('some element').once .and_yield('some element').once
allow(element).to receive(:matches?) allow(element).to receive(:matches?)
.with('some element').and_return(true) .with('some element').and_return(true)
...@@ -45,7 +45,7 @@ describe QA::Page::View do ...@@ -45,7 +45,7 @@ describe QA::Page::View do
context 'when pattern has not been found' do context 'when pattern has not been found' do
before do before do
allow(File).to receive(:foreach) allow(::File).to receive(:foreach)
.and_yield('some element').once .and_yield('some element').once
allow(element).to receive(:matches?) allow(element).to receive(:matches?)
.with('some element').and_return(false) .with('some element').and_return(false)
......
...@@ -30,7 +30,7 @@ describe QA::Scenario::Test::Instance do ...@@ -30,7 +30,7 @@ describe QA::Scenario::Test::Instance do
subject.perform("test") subject.perform("test")
expect(runner).to have_received(:options=) expect(runner).to have_received(:options=)
.with(File.expand_path('../../../qa/specs/features', __dir__)) .with(::File.expand_path('../../../qa/specs/features', __dir__))
end end
end end
......
require_relative '../qa' 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| RSpec.configure do |config|
config.expect_with :rspec do |expectations| 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