Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2019-03-19 17:37:08 +0300
committerLin Jen-Shin <godfat@godfat.org>2019-03-19 17:37:08 +0300
commitae9d60ac2b5f439abe040373d0c70ea707d90b9d (patch)
tree31b0bf3862cf317e4d50dbe7dd5e9ba3a888ccfc /spec/support
parent645653a49eaafccab3276f52fdfbfaa5c3e3c540 (diff)
parentb789bfaeefd9838c33f13c028893424025ade1ad (diff)
Merge branch '58844-follow-up-from-don-t-create-ee-specific-files-when-creating-emojis-fixture-files' into 'master'
Simplify JavaScriptFixturesHelpers Closes gitlab-ee#10386, #58898, and #58844 See merge request gitlab-org/gitlab-ce!26045
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers/javascript_fixtures_helpers.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/spec/support/helpers/javascript_fixtures_helpers.rb b/spec/support/helpers/javascript_fixtures_helpers.rb
index f525b2f945e..cceb179d53e 100644
--- a/spec/support/helpers/javascript_fixtures_helpers.rb
+++ b/spec/support/helpers/javascript_fixtures_helpers.rb
@@ -5,7 +5,7 @@ module JavaScriptFixturesHelpers
extend ActiveSupport::Concern
include Gitlab::Popen
- FIXTURE_PATHS = %w[spec/javascripts/fixtures ee/spec/javascripts/fixtures].freeze
+ extend self
included do |base|
base.around do |example|
@@ -14,32 +14,32 @@ module JavaScriptFixturesHelpers
end
end
+ def fixture_root_path
+ 'spec/javascripts/fixtures'
+ end
+
# Public: Removes all fixture files from given directory
#
- # directory_name - directory of the fixtures (relative to FIXTURE_PATHS)
+ # directory_name - directory of the fixtures (relative to .fixture_root_path)
#
def clean_frontend_fixtures(directory_name)
- FIXTURE_PATHS.each do |fixture_path|
- directory_name = File.expand_path(directory_name, fixture_path)
- Dir[File.expand_path('*.html.raw', directory_name)].each do |file_name|
- FileUtils.rm(file_name)
- end
+ full_directory_name = File.expand_path(directory_name, fixture_root_path)
+ Dir[File.expand_path('*.html.raw', full_directory_name)].each do |file_name|
+ FileUtils.rm(file_name)
end
end
# Public: Store a response object as fixture file
#
# response - string or response object to store
- # fixture_file_name - file name to store the fixture in (relative to FIXTURE_PATHS)
+ # fixture_file_name - file name to store the fixture in (relative to .fixture_root_path)
#
def store_frontend_fixture(response, fixture_file_name)
- FIXTURE_PATHS.each do |fixture_path|
- fixture_file_name = File.expand_path(fixture_file_name, fixture_path)
- fixture = response.respond_to?(:body) ? parse_response(response) : response
+ full_fixture_path = File.expand_path(fixture_file_name, fixture_root_path)
+ fixture = response.respond_to?(:body) ? parse_response(response) : response
- FileUtils.mkdir_p(File.dirname(fixture_file_name))
- File.write(fixture_file_name, fixture)
- end
+ FileUtils.mkdir_p(File.dirname(full_fixture_path))
+ File.write(full_fixture_path, fixture)
end
def remove_repository(project)