diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2019-04-01 17:36:11 +0300 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2019-04-01 17:36:11 +0300 |
commit | 04bb35a4b562fd57b14c55645bb1848a50cdef56 (patch) | |
tree | 1bd1ac2af6a5c088ac2529cdbccceeca402d3ebe /spec/support/helpers/javascript_fixtures_helpers.rb | |
parent | ade207e575ab846f6d354aaccc1382a6e512dd0d (diff) | |
parent | b8118a65d595040bfce2d83d5e38dd63ebfedb58 (diff) | |
download | gitlab-ce-04bb35a4b562fd57b14c55645bb1848a50cdef56.tar.gz |
Merge branch 'master' into id-split-self-approval-restrictionsid-split-self-approval-restrictions
Diffstat (limited to 'spec/support/helpers/javascript_fixtures_helpers.rb')
-rw-r--r-- | spec/support/helpers/javascript_fixtures_helpers.rb | 28 |
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..9cae8f934db 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', 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) |