diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-03-07 18:34:33 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-03-07 18:34:33 +0300 |
commit | 7aa3c9b30fc82e91a6b0f72b52343cd935740ee3 (patch) | |
tree | d6c046dedff7e0e090bebb87bcc85e802ce0ee48 /spec/javascripts/fixtures | |
parent | 482b86ae1561f175e6809ad34bb07de7b84b1d9d (diff) | |
parent | f5a4adf4622dfa4fdd751c8cbcb7028bdc7fd7e3 (diff) |
Merge branch 'ce-extract-ee-specific-code-for-spec/support' into 'master'
[CE] Extract EE specific code for spec/support
See merge request gitlab-org/gitlab-ce!25569
Diffstat (limited to 'spec/javascripts/fixtures')
-rw-r--r-- | spec/javascripts/fixtures/static_fixtures.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/spec/javascripts/fixtures/static_fixtures.rb b/spec/javascripts/fixtures/static_fixtures.rb index 4569f16f0ca..852a82587b9 100644 --- a/spec/javascripts/fixtures/static_fixtures.rb +++ b/spec/javascripts/fixtures/static_fixtures.rb @@ -7,23 +7,23 @@ describe ApplicationController, '(Static JavaScript fixtures)', type: :controlle clean_frontend_fixtures('static/') end - fixtures_path = File.expand_path(JavaScriptFixturesHelpers::FIXTURE_PATH, Rails.root) - haml_fixtures = Dir.glob(File.expand_path('**/*.haml', fixtures_path)).map do |file_path| - file_path.sub(/\A#{fixtures_path}#{File::SEPARATOR}/, '') - end + JavaScriptFixturesHelpers::FIXTURE_PATHS.each do |fixture_path| + fixtures_path = File.expand_path(fixture_path, Rails.root) + + Dir.glob(File.expand_path('**/*.haml', fixtures_path)).map do |file_path| + template_file_name = file_path.sub(/\A#{fixtures_path}#{File::SEPARATOR}/, '') - haml_fixtures.each do |template_file_name| - it "static/#{template_file_name.sub(/\.haml\z/, '.raw')}" do |example| - fixture_file_name = example.description - rendered = render_template(template_file_name) - store_frontend_fixture(rendered, fixture_file_name) + it "static/#{template_file_name.sub(/\.haml\z/, '.raw')}" do |example| + fixture_file_name = example.description + rendered = render_template(fixture_path, template_file_name) + store_frontend_fixture(rendered, fixture_file_name) + end end end private - def render_template(template_file_name) - fixture_path = JavaScriptFixturesHelpers::FIXTURE_PATH + def render_template(fixture_path, template_file_name) controller = ApplicationController.new controller.prepend_view_path(fixture_path) controller.render_to_string(template: template_file_name, layout: false) |