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

static_fixtures.rb « fixtures « javascripts « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cb4b90cdca595e22b5af9b9e95429c8e02e71356 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'spec_helper'

describe ApplicationController, '(Static JavaScript fixtures)', type: :controller do
  include JavaScriptFixturesHelpers

  Dir.glob('{,ee/}spec/javascripts/fixtures/**/*.haml').map do |file_path|
    it "static/#{file_path.sub(%r{\A(ee/)?spec/javascripts/fixtures/}, '').sub(/\.haml\z/, '')}" do |example|
      store_frontend_fixture(render_template(file_path), example.description)
    end
  end

  private

  def render_template(template_file_name)
    controller = ApplicationController.new
    controller.prepend_view_path(File.dirname(template_file_name))
    controller.render_to_string(template: File.basename(template_file_name), layout: false)
  end
end