From 4cd962ec6ec2b037983c1a0d7c1097e8b1f70f52 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 30 Dec 2016 14:46:41 -0600 Subject: [PATCH 1/9] allow storage of raw string fixtures --- spec/support/javascript_fixtures_helpers.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/spec/support/javascript_fixtures_helpers.rb b/spec/support/javascript_fixtures_helpers.rb index 99e98eebdb4..29dd4de62ff 100644 --- a/spec/support/javascript_fixtures_helpers.rb +++ b/spec/support/javascript_fixtures_helpers.rb @@ -20,11 +20,24 @@ module JavaScriptFixturesHelpers # Public: Store a response object as fixture file # - # response - response object to store + # response - string or response object to store # fixture_file_name - file name to store the fixture in (relative to FIXTURE_PATH) # def store_frontend_fixture(response, fixture_file_name) fixture_file_name = File.expand_path(fixture_file_name, FIXTURE_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 + + private + + # Private: Prepare a response object for use as a frontend fixture + # + # response - response object to prepare + # + def parse_response(response) fixture = response.body response_mime_type = Mime::Type.lookup(response.content_type) @@ -44,7 +57,6 @@ module JavaScriptFixturesHelpers fixture.gsub!(%r{="/}, "=\"http://#{test_host}/") end - FileUtils.mkdir_p(File.dirname(fixture_file_name)) - File.write(fixture_file_name, fixture) + fixture end end From 2373082eb0d6b2f8eff9632a7b96febd9dd794c5 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 30 Dec 2016 14:47:12 -0600 Subject: [PATCH 2/9] create catch-all fixture generator for all static fixtures --- spec/javascripts/fixtures/static_fixtures.rb | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 spec/javascripts/fixtures/static_fixtures.rb diff --git a/spec/javascripts/fixtures/static_fixtures.rb b/spec/javascripts/fixtures/static_fixtures.rb new file mode 100644 index 00000000000..4569f16f0ca --- /dev/null +++ b/spec/javascripts/fixtures/static_fixtures.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe ApplicationController, '(Static JavaScript fixtures)', type: :controller do + include JavaScriptFixturesHelpers + + before(:all) do + 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 + + 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) + end + end + + private + + def render_template(template_file_name) + fixture_path = JavaScriptFixturesHelpers::FIXTURE_PATH + controller = ApplicationController.new + controller.prepend_view_path(fixture_path) + controller.render_to_string(template: template_file_name, layout: false) + end +end From 6370e326995ccb1c1c816b007c63f10d0c7cda25 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 30 Dec 2016 14:50:07 -0600 Subject: [PATCH 3/9] recursively clean compiled fixtures --- spec/support/javascript_fixtures_helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/javascript_fixtures_helpers.rb b/spec/support/javascript_fixtures_helpers.rb index 29dd4de62ff..6817ccb1da7 100644 --- a/spec/support/javascript_fixtures_helpers.rb +++ b/spec/support/javascript_fixtures_helpers.rb @@ -13,7 +13,7 @@ module JavaScriptFixturesHelpers # def clean_frontend_fixtures(directory_name) directory_name = File.expand_path(directory_name, FIXTURE_PATH) - Dir[File.expand_path('*.html.raw', directory_name)].each do |file_name| + Dir[File.expand_path('**/*.html.raw', directory_name)].each do |file_name| FileUtils.rm(file_name) end end From 5f192c77e09a9af19268e5c5cf860ffd8c0c6216 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 30 Dec 2016 15:27:40 -0600 Subject: [PATCH 4/9] update all frontend tests to point to precompiled fixtures --- spec/javascripts/activities_spec.js.es6 | 2 +- spec/javascripts/behaviors/quick_submit_spec.js | 4 ++-- spec/javascripts/behaviors/requires_input_spec.js | 4 ++-- spec/javascripts/bootstrap_linked_tabs_spec.js.es6 | 4 ++-- spec/javascripts/dashboard_spec.js.es6 | 2 +- .../environments/environment_actions_spec.js.es6 | 4 ++-- .../environment_external_url_spec.js.es6 | 4 ++-- .../environments/environment_item_spec.js.es6 | 4 ++-- .../environments/environment_rollback_spec.js.es6 | 4 ++-- .../environments/environment_stop_spec.js.es6 | 4 ++-- spec/javascripts/gl_dropdown_spec.js.es6 | 4 ++-- spec/javascripts/gl_field_errors_spec.js.es6 | 4 ++-- spec/javascripts/header_spec.js | 2 +- spec/javascripts/issuable_spec.js.es6 | 6 +++--- spec/javascripts/issue_spec.js | 12 ++++++------ spec/javascripts/labels_issue_sidebar_spec.js.es6 | 4 ++-- spec/javascripts/line_highlighter_spec.js | 4 ++-- spec/javascripts/merge_request_spec.js | 4 ++-- spec/javascripts/merge_request_tabs_spec.js | 4 ++-- .../mini_pipeline_graph_dropdown_spec.js.es6 | 4 ++-- spec/javascripts/new_branch_spec.js | 4 ++-- spec/javascripts/notes_spec.js | 2 +- spec/javascripts/pipelines_spec.js.es6 | 4 ++-- spec/javascripts/project_title_spec.js | 4 ++-- spec/javascripts/search_autocomplete_spec.js | 4 ++-- spec/javascripts/signin_tabs_memoizer_spec.js.es6 | 2 +- spec/javascripts/u2f/authenticate_spec.js | 2 +- spec/javascripts/u2f/register_spec.js | 2 +- spec/support/javascript_fixtures_helpers.rb | 2 +- 29 files changed, 55 insertions(+), 55 deletions(-) diff --git a/spec/javascripts/activities_spec.js.es6 b/spec/javascripts/activities_spec.js.es6 index 192da4ee8d9..f0138945637 100644 --- a/spec/javascripts/activities_spec.js.es6 +++ b/spec/javascripts/activities_spec.js.es6 @@ -7,7 +7,7 @@ (() => { window.gon || (window.gon = {}); - const fixtureTemplate = 'event_filter.html'; + const fixtureTemplate = 'static/event_filter.html.raw'; const filters = [ { id: 'all', diff --git a/spec/javascripts/behaviors/quick_submit_spec.js b/spec/javascripts/behaviors/quick_submit_spec.js index 0f61000bc37..f4a977b9dea 100644 --- a/spec/javascripts/behaviors/quick_submit_spec.js +++ b/spec/javascripts/behaviors/quick_submit_spec.js @@ -5,9 +5,9 @@ (function() { describe('Quick Submit behavior', function() { var keydownEvent; - fixture.preload('behaviors/quick_submit.html'); + fixture.preload('static/behaviors/quick_submit.html.raw'); beforeEach(function() { - fixture.load('behaviors/quick_submit.html'); + fixture.load('static/behaviors/quick_submit.html.raw'); $('form').submit(function(e) { // Prevent a form submit from moving us off the testing page return e.preventDefault(); diff --git a/spec/javascripts/behaviors/requires_input_spec.js b/spec/javascripts/behaviors/requires_input_spec.js index c3f4c867d6a..8b21551bd10 100644 --- a/spec/javascripts/behaviors/requires_input_spec.js +++ b/spec/javascripts/behaviors/requires_input_spec.js @@ -4,9 +4,9 @@ (function() { describe('requiresInput', function() { - fixture.preload('behaviors/requires_input.html'); + fixture.preload('static/behaviors/requires_input.html.raw'); beforeEach(function() { - return fixture.load('behaviors/requires_input.html'); + return fixture.load('static/behaviors/requires_input.html.raw'); }); it('disables submit when any field is required', function() { $('.js-requires-input').requiresInput(); diff --git a/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 b/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 index 133712debab..e5256520c24 100644 --- a/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 +++ b/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 @@ -2,10 +2,10 @@ (() => { describe('Linked Tabs', () => { - fixture.preload('linked_tabs'); + fixture.preload('static/linked_tabs.html.raw'); beforeEach(() => { - fixture.load('linked_tabs'); + fixture.load('static/linked_tabs.html.raw'); }); describe('when is initialized', () => { diff --git a/spec/javascripts/dashboard_spec.js.es6 b/spec/javascripts/dashboard_spec.js.es6 index aadf6f518a8..76fe4878519 100644 --- a/spec/javascripts/dashboard_spec.js.es6 +++ b/spec/javascripts/dashboard_spec.js.es6 @@ -7,7 +7,7 @@ ((global) => { describe('Dashboard', () => { - const fixtureTemplate = 'dashboard.html'; + const fixtureTemplate = 'static/dashboard.html.raw'; function todosCountText() { return $('.js-todos-count').text(); diff --git a/spec/javascripts/environments/environment_actions_spec.js.es6 b/spec/javascripts/environments/environment_actions_spec.js.es6 index 4bae3f30bb5..c2ac3523483 100644 --- a/spec/javascripts/environments/environment_actions_spec.js.es6 +++ b/spec/javascripts/environments/environment_actions_spec.js.es6 @@ -2,10 +2,10 @@ //= require environments/components/environment_actions describe('Actions Component', () => { - fixture.preload('environments/element.html'); + fixture.preload('static/environments/element.html.raw'); beforeEach(() => { - fixture.load('environments/element.html'); + fixture.load('static/environments/element.html.raw'); }); it('should render a dropdown with the provided actions', () => { diff --git a/spec/javascripts/environments/environment_external_url_spec.js.es6 b/spec/javascripts/environments/environment_external_url_spec.js.es6 index 9f82567c35b..d578a017d44 100644 --- a/spec/javascripts/environments/environment_external_url_spec.js.es6 +++ b/spec/javascripts/environments/environment_external_url_spec.js.es6 @@ -2,9 +2,9 @@ //= require environments/components/environment_external_url describe('External URL Component', () => { - fixture.preload('environments/element.html'); + fixture.preload('static/environments/element.html.raw'); beforeEach(() => { - fixture.load('environments/element.html'); + fixture.load('static/environments/element.html.raw'); }); it('should link to the provided externalUrl prop', () => { diff --git a/spec/javascripts/environments/environment_item_spec.js.es6 b/spec/javascripts/environments/environment_item_spec.js.es6 index 5d7c6b2411d..7b53152108f 100644 --- a/spec/javascripts/environments/environment_item_spec.js.es6 +++ b/spec/javascripts/environments/environment_item_spec.js.es6 @@ -3,9 +3,9 @@ //= require environments/components/environment_item describe('Environment item', () => { - fixture.preload('environments/table.html'); + fixture.preload('static/environments/table.html.raw'); beforeEach(() => { - fixture.load('environments/table.html'); + fixture.load('static/environments/table.html.raw'); }); describe('When item is folder', () => { diff --git a/spec/javascripts/environments/environment_rollback_spec.js.es6 b/spec/javascripts/environments/environment_rollback_spec.js.es6 index 77ba0ab38ec..bfa20d6f2e5 100644 --- a/spec/javascripts/environments/environment_rollback_spec.js.es6 +++ b/spec/javascripts/environments/environment_rollback_spec.js.es6 @@ -1,12 +1,12 @@ //= require vue //= require environments/components/environment_rollback describe('Rollback Component', () => { - fixture.preload('environments/element.html'); + fixture.preload('static/environments/element.html.raw'); const retryURL = 'https://gitlab.com/retry'; beforeEach(() => { - fixture.load('environments/element.html'); + fixture.load('static/environments/element.html.raw'); }); it('Should link to the provided retryUrl', () => { diff --git a/spec/javascripts/environments/environment_stop_spec.js.es6 b/spec/javascripts/environments/environment_stop_spec.js.es6 index 84a41b2bf46..c3c5f2cc4c8 100644 --- a/spec/javascripts/environments/environment_stop_spec.js.es6 +++ b/spec/javascripts/environments/environment_stop_spec.js.es6 @@ -1,13 +1,13 @@ //= require vue //= require environments/components/environment_stop describe('Stop Component', () => { - fixture.preload('environments/element.html'); + fixture.preload('static/environments/element.html.raw'); let stopURL; let component; beforeEach(() => { - fixture.load('environments/element.html'); + fixture.load('static/environments/element.html.raw'); stopURL = '/stop'; component = new window.gl.environmentsList.StopComponent({ diff --git a/spec/javascripts/gl_dropdown_spec.js.es6 b/spec/javascripts/gl_dropdown_spec.js.es6 index bfaf90e2aee..5f9359007ac 100644 --- a/spec/javascripts/gl_dropdown_spec.js.es6 +++ b/spec/javascripts/gl_dropdown_spec.js.es6 @@ -43,7 +43,7 @@ } describe('Dropdown', function describeDropdown() { - fixture.preload('gl_dropdown.html'); + fixture.preload('static/gl_dropdown.html.raw'); fixture.preload('projects.json'); function initDropDown(hasRemote, isFilterable) { @@ -61,7 +61,7 @@ } beforeEach(() => { - fixture.load('gl_dropdown.html'); + fixture.load('static/gl_dropdown.html.raw'); this.dropdownContainerElement = $('.dropdown.inline'); this.$dropdownMenuElement = $('.dropdown-menu', this.dropdownContainerElement); this.projectsData = fixture.load('projects.json')[0]; diff --git a/spec/javascripts/gl_field_errors_spec.js.es6 b/spec/javascripts/gl_field_errors_spec.js.es6 index 5018e87ad6c..d314b23a7ed 100644 --- a/spec/javascripts/gl_field_errors_spec.js.es6 +++ b/spec/javascripts/gl_field_errors_spec.js.es6 @@ -4,11 +4,11 @@ //= require gl_field_errors ((global) => { - fixture.preload('gl_field_errors.html'); + fixture.preload('static/gl_field_errors.html.raw'); describe('GL Style Field Errors', function() { beforeEach(function() { - fixture.load('gl_field_errors.html'); + fixture.load('static/gl_field_errors.html.raw'); const $form = this.$form = $('form.gl-show-field-errors'); this.fieldErrors = new global.GlFieldErrors($form); }); diff --git a/spec/javascripts/header_spec.js b/spec/javascripts/header_spec.js index d2bcbc37b64..b413a3357f3 100644 --- a/spec/javascripts/header_spec.js +++ b/spec/javascripts/header_spec.js @@ -7,7 +7,7 @@ describe('Header', function() { var todosPendingCount = '.todos-pending-count'; - var fixtureTemplate = 'header.html'; + var fixtureTemplate = 'static/header.html.raw'; function isTodosCountHidden() { return $(todosPendingCount).hasClass('hidden'); diff --git a/spec/javascripts/issuable_spec.js.es6 b/spec/javascripts/issuable_spec.js.es6 index d61601ee4fb..846a3907c3d 100644 --- a/spec/javascripts/issuable_spec.js.es6 +++ b/spec/javascripts/issuable_spec.js.es6 @@ -21,10 +21,10 @@ } describe('Issuable', () => { - fixture.preload('issuable_filter'); + fixture.preload('static/issuable_filter.html.raw'); beforeEach(() => { - fixture.load('issuable_filter'); + fixture.load('static/issuable_filter.html.raw'); Issuable.init(); }); @@ -37,7 +37,7 @@ beforeEach(() => { $filtersForm = $('.js-filter-form'); - fixture.load('issuable_filter'); + fixture.load('static/issuable_filter.html.raw'); resetForm($filtersForm); }); diff --git a/spec/javascripts/issue_spec.js b/spec/javascripts/issue_spec.js index faab5ae00c2..421936a4786 100644 --- a/spec/javascripts/issue_spec.js +++ b/spec/javascripts/issue_spec.js @@ -8,9 +8,9 @@ var INVALID_URL = 'http://goesnowhere.nothing/whereami'; var $boxClosed, $boxOpen, $btnClose, $btnReopen; - fixture.preload('issues/closed-issue.html'); - fixture.preload('issues/issue-with-task-list.html'); - fixture.preload('issues/open-issue.html'); + fixture.preload('issues/closed-issue.html.raw'); + fixture.preload('issues/issue-with-task-list.html.raw'); + fixture.preload('issues/open-issue.html.raw'); function expectErrorMessage() { var $flashMessage = $('div.flash-alert'); @@ -61,7 +61,7 @@ describe('Issue', function() { describe('task lists', function() { - fixture.load('issues/issue-with-task-list.html'); + fixture.load('issues/issue-with-task-list.html.raw'); beforeEach(function() { this.issue = new Issue(); }); @@ -86,7 +86,7 @@ describe('close issue', function() { beforeEach(function() { - fixture.load('issues/open-issue.html'); + fixture.load('issues/open-issue.html.raw'); findElements(); this.issue = new Issue(); @@ -140,7 +140,7 @@ describe('reopen issue', function() { beforeEach(function() { - fixture.load('issues/closed-issue.html'); + fixture.load('issues/closed-issue.html.raw'); findElements(); this.issue = new Issue(); diff --git a/spec/javascripts/labels_issue_sidebar_spec.js.es6 b/spec/javascripts/labels_issue_sidebar_spec.js.es6 index 0c48d04776f..de788ef7027 100644 --- a/spec/javascripts/labels_issue_sidebar_spec.js.es6 +++ b/spec/javascripts/labels_issue_sidebar_spec.js.es6 @@ -17,10 +17,10 @@ (() => { let saveLabelCount = 0; describe('Issue dropdown sidebar', () => { - fixture.preload('issue_sidebar_label.html'); + fixture.preload('static/issue_sidebar_label.html.raw'); beforeEach(() => { - fixture.load('issue_sidebar_label.html'); + fixture.load('static/issue_sidebar_label.html.raw'); new IssuableContext('{"id":1,"name":"Administrator","username":"root"}'); new LabelsSelect(); diff --git a/spec/javascripts/line_highlighter_spec.js b/spec/javascripts/line_highlighter_spec.js index decdf583410..15f2c0e6ed4 100644 --- a/spec/javascripts/line_highlighter_spec.js +++ b/spec/javascripts/line_highlighter_spec.js @@ -6,7 +6,7 @@ (function() { describe('LineHighlighter', function() { var clickLine; - fixture.preload('line_highlighter.html'); + fixture.preload('static/line_highlighter.html.raw'); clickLine = function(number, eventData) { var e; if (eventData == null) { @@ -20,7 +20,7 @@ } }; beforeEach(function() { - fixture.load('line_highlighter.html'); + fixture.load('static/line_highlighter.html.raw'); this["class"] = new LineHighlighter(); this.css = this["class"].highlightClass; return this.spies = { diff --git a/spec/javascripts/merge_request_spec.js b/spec/javascripts/merge_request_spec.js index 4cf1693af1b..68afb4af3c1 100644 --- a/spec/javascripts/merge_request_spec.js +++ b/spec/javascripts/merge_request_spec.js @@ -6,9 +6,9 @@ (function() { describe('MergeRequest', function() { return describe('task lists', function() { - fixture.preload('merge_requests_show.html'); + fixture.preload('static/merge_requests_show.html.raw'); beforeEach(function() { - fixture.load('merge_requests_show.html'); + fixture.load('static/merge_requests_show.html.raw'); return this.merge = new MergeRequest(); }); it('modifies the Markdown field', function() { diff --git a/spec/javascripts/merge_request_tabs_spec.js b/spec/javascripts/merge_request_tabs_spec.js index 130d391bfab..1104f123b25 100644 --- a/spec/javascripts/merge_request_tabs_spec.js +++ b/spec/javascripts/merge_request_tabs_spec.js @@ -16,7 +16,7 @@ }; $.extend(stubLocation, defaults, stubs || {}); }; - fixture.preload('merge_request_tabs.html'); + fixture.preload('static/merge_request_tabs.html.raw'); beforeEach(function () { this.class = new gl.MergeRequestTabs({ stubLocation: stubLocation }); @@ -30,7 +30,7 @@ describe('#activateTab', function () { beforeEach(function () { spyOn($, 'ajax').and.callFake(function () {}); - fixture.load('merge_request_tabs.html'); + fixture.load('static/merge_request_tabs.html.raw'); this.subject = this.class.activateTab; }); it('shows the first tab when action is show', function () { diff --git a/spec/javascripts/mini_pipeline_graph_dropdown_spec.js.es6 b/spec/javascripts/mini_pipeline_graph_dropdown_spec.js.es6 index d1793e9308e..0cbfce8fbab 100644 --- a/spec/javascripts/mini_pipeline_graph_dropdown_spec.js.es6 +++ b/spec/javascripts/mini_pipeline_graph_dropdown_spec.js.es6 @@ -5,10 +5,10 @@ (() => { describe('Mini Pipeline Graph Dropdown', () => { - fixture.preload('mini_dropdown_graph'); + fixture.preload('static/mini_dropdown_graph.html.raw'); beforeEach(() => { - fixture.load('mini_dropdown_graph'); + fixture.load('static/mini_dropdown_graph.html.raw'); }); describe('When is initialized', () => { diff --git a/spec/javascripts/new_branch_spec.js b/spec/javascripts/new_branch_spec.js index a6cb9e47744..ba2c6f419e9 100644 --- a/spec/javascripts/new_branch_spec.js +++ b/spec/javascripts/new_branch_spec.js @@ -8,7 +8,7 @@ describe('Branch', function() { return describe('create a new branch', function() { var expectToHaveError, fillNameWith; - fixture.preload('new_branch.html'); + fixture.preload('static/new_branch.html.raw'); fillNameWith = function(value) { return $('.js-branch-name').val(value).trigger('blur'); }; @@ -16,7 +16,7 @@ return expect($('.js-branch-name-error span').text()).toEqual(error); }; beforeEach(function() { - fixture.load('new_branch.html'); + fixture.load('static/new_branch.html.raw'); $('form').on('submit', function(e) { return e.preventDefault(); }); diff --git a/spec/javascripts/notes_spec.js b/spec/javascripts/notes_spec.js index d3bfa7730fa..5ea50ce43f7 100644 --- a/spec/javascripts/notes_spec.js +++ b/spec/javascripts/notes_spec.js @@ -12,7 +12,7 @@ gl.utils = gl.utils || {}; describe('Notes', function() { - var commentsTemplate = 'issues/issue_with_comment.raw'; + var commentsTemplate = 'issues/issue_with_comment.html.raw'; fixture.preload(commentsTemplate); beforeEach(function () { diff --git a/spec/javascripts/pipelines_spec.js.es6 b/spec/javascripts/pipelines_spec.js.es6 index 85c9cf4b4f1..27b9c4a2e28 100644 --- a/spec/javascripts/pipelines_spec.js.es6 +++ b/spec/javascripts/pipelines_spec.js.es6 @@ -2,10 +2,10 @@ (() => { describe('Pipelines', () => { - fixture.preload('pipeline_graph'); + fixture.preload('static/pipeline_graph.html.raw'); beforeEach(() => { - fixture.load('pipeline_graph'); + fixture.load('static/pipeline_graph.html.raw'); }); it('should be defined', () => { diff --git a/spec/javascripts/project_title_spec.js b/spec/javascripts/project_title_spec.js index 216b77f37c0..677094f2c9d 100644 --- a/spec/javascripts/project_title_spec.js +++ b/spec/javascripts/project_title_spec.js @@ -16,10 +16,10 @@ window.gon.api_version = 'v3'; describe('Project Title', function() { - fixture.preload('project_title.html'); + fixture.preload('static/project_title.html.raw'); fixture.preload('projects.json'); beforeEach(function() { - fixture.load('project_title.html'); + fixture.load('static/project_title.html.raw'); return this.project = new Project(); }); return describe('project list', function() { diff --git a/spec/javascripts/search_autocomplete_spec.js b/spec/javascripts/search_autocomplete_spec.js index 1b7f642d59e..b6e7815c6cc 100644 --- a/spec/javascripts/search_autocomplete_spec.js +++ b/spec/javascripts/search_autocomplete_spec.js @@ -112,9 +112,9 @@ }; describe('Search autocomplete dropdown', function() { - fixture.preload('search_autocomplete.html'); + fixture.preload('static/search_autocomplete.html.raw'); beforeEach(function() { - fixture.load('search_autocomplete.html'); + fixture.load('static/search_autocomplete.html.raw'); return widget = new gl.SearchAutocomplete; }); it('should show Dashboard specific dropdown menu', function() { diff --git a/spec/javascripts/signin_tabs_memoizer_spec.js.es6 b/spec/javascripts/signin_tabs_memoizer_spec.js.es6 index 9a9fb22255b..416a5b1aafb 100644 --- a/spec/javascripts/signin_tabs_memoizer_spec.js.es6 +++ b/spec/javascripts/signin_tabs_memoizer_spec.js.es6 @@ -2,7 +2,7 @@ ((global) => { describe('SigninTabsMemoizer', () => { - const fixtureTemplate = 'signin_tabs.html'; + const fixtureTemplate = 'static/signin_tabs.html.raw'; const tabSelector = 'ul.nav-tabs'; const currentTabKey = 'current_signin_tab'; let memo; diff --git a/spec/javascripts/u2f/authenticate_spec.js b/spec/javascripts/u2f/authenticate_spec.js index 064d18519ea..b88b5b932a7 100644 --- a/spec/javascripts/u2f/authenticate_spec.js +++ b/spec/javascripts/u2f/authenticate_spec.js @@ -10,7 +10,7 @@ (function() { describe('U2FAuthenticate', function() { - fixture.load('u2f/authenticate'); + fixture.load('static/u2f/authenticate.html.raw'); beforeEach(function() { this.u2fDevice = new MockU2FDevice; this.container = $("#js-authenticate-u2f"); diff --git a/spec/javascripts/u2f/register_spec.js b/spec/javascripts/u2f/register_spec.js index 189592ea87a..8a72c532941 100644 --- a/spec/javascripts/u2f/register_spec.js +++ b/spec/javascripts/u2f/register_spec.js @@ -10,7 +10,7 @@ (function() { describe('U2FRegister', function() { - fixture.load('u2f/register'); + fixture.load('static/u2f/register.html.raw'); beforeEach(function() { this.u2fDevice = new MockU2FDevice; this.container = $("#js-register-u2f"); diff --git a/spec/support/javascript_fixtures_helpers.rb b/spec/support/javascript_fixtures_helpers.rb index 6817ccb1da7..29dd4de62ff 100644 --- a/spec/support/javascript_fixtures_helpers.rb +++ b/spec/support/javascript_fixtures_helpers.rb @@ -13,7 +13,7 @@ module JavaScriptFixturesHelpers # def clean_frontend_fixtures(directory_name) directory_name = File.expand_path(directory_name, FIXTURE_PATH) - Dir[File.expand_path('**/*.html.raw', directory_name)].each do |file_name| + Dir[File.expand_path('*.html.raw', directory_name)].each do |file_name| FileUtils.rm(file_name) end end From 7ae2fe132c7cad345c09575493d094767cdc96ce Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 30 Dec 2016 17:28:51 -0600 Subject: [PATCH 5/9] fix dynamic u2f fixtures --- spec/javascripts/fixtures/u2f.rb | 35 +++++++++++++++++++ .../fixtures/u2f/authenticate.html.haml | 1 - .../fixtures/u2f/register.html.haml | 2 -- spec/javascripts/u2f/authenticate_spec.js | 2 +- spec/javascripts/u2f/register_spec.js | 2 +- 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 spec/javascripts/fixtures/u2f.rb delete mode 100644 spec/javascripts/fixtures/u2f/authenticate.html.haml delete mode 100644 spec/javascripts/fixtures/u2f/register.html.haml diff --git a/spec/javascripts/fixtures/u2f.rb b/spec/javascripts/fixtures/u2f.rb new file mode 100644 index 00000000000..076c38ec4b1 --- /dev/null +++ b/spec/javascripts/fixtures/u2f.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +describe SessionsController, '(JavaScript fixtures)', type: :controller do + include JavaScriptFixturesHelpers + + before(:all) do + clean_frontend_fixtures('u2f/') + end + + it 'u2f/authenticate.html.raw' do |example| + fixture = render_template('u2f/_authenticate.html.haml', locals: { + new_user_session_path: "/users/sign_in", + params: {}, + resource_name: "user" + }) + store_frontend_fixture(fixture, example.description) + end + + it 'u2f/register.html.raw' do |example| + user = build(:user, :two_factor_via_otp) + + fixture = render_template('u2f/_register.html.haml', locals: { + create_u2f_profile_two_factor_auth_path: '/profile/two_factor_auth/create_u2f', + current_user: user + }) + store_frontend_fixture(fixture, example.description) + end + + private + + def render_template(template, **args) + controller = ApplicationController.new + controller.render_to_string(template: template, layout: false, **args) + end +end diff --git a/spec/javascripts/fixtures/u2f/authenticate.html.haml b/spec/javascripts/fixtures/u2f/authenticate.html.haml deleted file mode 100644 index 779d6429a5f..00000000000 --- a/spec/javascripts/fixtures/u2f/authenticate.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render partial: "u2f/authenticate", locals: { new_user_session_path: "/users/sign_in", params: {}, resource_name: "user" } diff --git a/spec/javascripts/fixtures/u2f/register.html.haml b/spec/javascripts/fixtures/u2f/register.html.haml deleted file mode 100644 index 5ed51be689c..00000000000 --- a/spec/javascripts/fixtures/u2f/register.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -- user = FactoryGirl.build(:user, :two_factor_via_otp) -= render partial: "u2f/register", locals: { create_u2f_profile_two_factor_auth_path: '/profile/two_factor_auth/create_u2f', current_user: user } diff --git a/spec/javascripts/u2f/authenticate_spec.js b/spec/javascripts/u2f/authenticate_spec.js index b88b5b932a7..cd40a1e321f 100644 --- a/spec/javascripts/u2f/authenticate_spec.js +++ b/spec/javascripts/u2f/authenticate_spec.js @@ -10,7 +10,7 @@ (function() { describe('U2FAuthenticate', function() { - fixture.load('static/u2f/authenticate.html.raw'); + fixture.load('u2f/authenticate.html.raw'); beforeEach(function() { this.u2fDevice = new MockU2FDevice; this.container = $("#js-authenticate-u2f"); diff --git a/spec/javascripts/u2f/register_spec.js b/spec/javascripts/u2f/register_spec.js index 8a72c532941..9fb150a2c8f 100644 --- a/spec/javascripts/u2f/register_spec.js +++ b/spec/javascripts/u2f/register_spec.js @@ -10,7 +10,7 @@ (function() { describe('U2FRegister', function() { - fixture.load('static/u2f/register.html.raw'); + fixture.load('u2f/register.html.raw'); beforeEach(function() { this.u2fDevice = new MockU2FDevice; this.container = $("#js-register-u2f"); From d904335dc7991318adb86f86f1d061c31bf873a2 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 30 Dec 2016 18:25:23 -0600 Subject: [PATCH 6/9] make projects.json easier to read --- spec/javascripts/fixtures/projects.json | 446 +++++++++++++++++++++++- 1 file changed, 445 insertions(+), 1 deletion(-) diff --git a/spec/javascripts/fixtures/projects.json b/spec/javascripts/fixtures/projects.json index 4919d77e5a4..4ce7f5c601a 100644 --- a/spec/javascripts/fixtures/projects.json +++ b/spec/javascripts/fixtures/projects.json @@ -1 +1,445 @@ -[{"id":9,"description":"","default_branch":null,"tag_list":[],"public":true,"archived":false,"visibility_level":20,"ssh_url_to_repo":"phil@localhost:root/test.git","http_url_to_repo":"http://localhost:3000/root/test.git","web_url":"http://localhost:3000/root/test","owner":{"name":"Administrator","username":"root","id":1,"state":"active","avatar_url":"http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon","web_url":"http://localhost:3000/u/root"},"name":"test","name_with_namespace":"Administrator / test","path":"test","path_with_namespace":"root/test","issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"builds_enabled":true,"snippets_enabled":false,"created_at":"2016-01-14T19:08:05.364Z","last_activity_at":"2016-01-14T19:08:07.418Z","shared_runners_enabled":true,"creator_id":1,"namespace":{"id":1,"name":"root","path":"root","owner_id":1,"created_at":"2016-01-13T20:19:44.439Z","updated_at":"2016-01-13T20:19:44.439Z","description":"","avatar":null},"avatar_url":null,"star_count":0,"forks_count":0,"only_allow_merge_if_build_succeeds":false,"open_issues_count":0,"permissions":{"project_access":null,"group_access":null}},{"id":8,"description":"Voluptatem quae nulla eius numquam ullam voluptatibus quia modi.","default_branch":"master","tag_list":[],"public":false,"archived":false,"visibility_level":0,"ssh_url_to_repo":"phil@localhost:h5bp/html5-boilerplate.git","http_url_to_repo":"http://localhost:3000/h5bp/html5-boilerplate.git","web_url":"http://localhost:3000/h5bp/html5-boilerplate","name":"Html5 Boilerplate","name_with_namespace":"H5bp / Html5 Boilerplate","path":"html5-boilerplate","path_with_namespace":"h5bp/html5-boilerplate","issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"builds_enabled":true,"snippets_enabled":false,"created_at":"2016-01-13T20:19:57.525Z","last_activity_at":"2016-01-13T20:27:57.280Z","shared_runners_enabled":true,"creator_id":1,"namespace":{"id":5,"name":"H5bp","path":"h5bp","owner_id":null,"created_at":"2016-01-13T20:19:57.239Z","updated_at":"2016-01-13T20:19:57.239Z","description":"Tempore accusantium possimus aut libero.","avatar":{"url":null}},"avatar_url":null,"star_count":0,"forks_count":0,"only_allow_merge_if_build_succeeds":false,"open_issues_count":5,"permissions":{"project_access":{"access_level":10,"notification_level":3},"group_access":{"access_level":50,"notification_level":3}}},{"id":7,"description":"Modi odio mollitia dolorem qui.","default_branch":"master","tag_list":[],"public":false,"archived":false,"visibility_level":0,"ssh_url_to_repo":"phil@localhost:twitter/typeahead-js.git","http_url_to_repo":"http://localhost:3000/twitter/typeahead-js.git","web_url":"http://localhost:3000/twitter/typeahead-js","name":"Typeahead.Js","name_with_namespace":"Twitter / Typeahead.Js","path":"typeahead-js","path_with_namespace":"twitter/typeahead-js","issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"builds_enabled":true,"snippets_enabled":false,"created_at":"2016-01-13T20:19:56.212Z","last_activity_at":"2016-01-13T20:27:51.496Z","shared_runners_enabled":true,"creator_id":1,"namespace":{"id":4,"name":"Twitter","path":"twitter","owner_id":null,"created_at":"2016-01-13T20:19:54.480Z","updated_at":"2016-01-13T20:19:54.480Z","description":"Id voluptatem ipsa maiores omnis repudiandae et et.","avatar":{"url":null}},"avatar_url":null,"star_count":0,"forks_count":0,"only_allow_merge_if_build_succeeds":true,"open_issues_count":4,"permissions":{"project_access":null,"group_access":{"access_level":10,"notification_level":3}}},{"id":6,"description":"Omnis asperiores ipsa et beatae quidem necessitatibus quia.","default_branch":"master","tag_list":[],"public":true,"archived":false,"visibility_level":20,"ssh_url_to_repo":"phil@localhost:twitter/flight.git","http_url_to_repo":"http://localhost:3000/twitter/flight.git","web_url":"http://localhost:3000/twitter/flight","name":"Flight","name_with_namespace":"Twitter / Flight","path":"flight","path_with_namespace":"twitter/flight","issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"builds_enabled":true,"snippets_enabled":false,"created_at":"2016-01-13T20:19:54.754Z","last_activity_at":"2016-01-13T20:27:50.502Z","shared_runners_enabled":true,"creator_id":1,"namespace":{"id":4,"name":"Twitter","path":"twitter","owner_id":null,"created_at":"2016-01-13T20:19:54.480Z","updated_at":"2016-01-13T20:19:54.480Z","description":"Id voluptatem ipsa maiores omnis repudiandae et et.","avatar":{"url":null}},"avatar_url":null,"star_count":0,"forks_count":0,"only_allow_merge_if_build_succeeds":true,"open_issues_count":4,"permissions":{"project_access":null,"group_access":{"access_level":10,"notification_level":3}}},{"id":5,"description":"Voluptatem commodi voluptate placeat architecto beatae illum dolores fugiat.","default_branch":"master","tag_list":[],"public":false,"archived":false,"visibility_level":0,"ssh_url_to_repo":"phil@localhost:gitlab-org/gitlab-test.git","http_url_to_repo":"http://localhost:3000/gitlab-org/gitlab-test.git","web_url":"http://localhost:3000/gitlab-org/gitlab-test","name":"Gitlab Test","name_with_namespace":"Gitlab Org / Gitlab Test","path":"gitlab-test","path_with_namespace":"gitlab-org/gitlab-test","issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"builds_enabled":true,"snippets_enabled":false,"created_at":"2016-01-13T20:19:53.202Z","last_activity_at":"2016-01-13T20:27:41.626Z","shared_runners_enabled":true,"creator_id":1,"namespace":{"id":3,"name":"Gitlab Org","path":"gitlab-org","owner_id":null,"created_at":"2016-01-13T20:19:48.851Z","updated_at":"2016-01-13T20:19:48.851Z","description":"Magni mollitia quod quidem soluta nesciunt impedit.","avatar":{"url":null}},"avatar_url":null,"star_count":0,"forks_count":0,"only_allow_merge_if_build_succeeds":false,"open_issues_count":5,"permissions":{"project_access":null,"group_access":{"access_level":50,"notification_level":3}}},{"id":4,"description":"Aut molestias quas est ut aperiam officia quod libero.","default_branch":"master","tag_list":[],"public":true,"archived":false,"visibility_level":20,"ssh_url_to_repo":"phil@localhost:gitlab-org/gitlab-shell.git","http_url_to_repo":"http://localhost:3000/gitlab-org/gitlab-shell.git","web_url":"http://localhost:3000/gitlab-org/gitlab-shell","name":"Gitlab Shell","name_with_namespace":"Gitlab Org / Gitlab Shell","path":"gitlab-shell","path_with_namespace":"gitlab-org/gitlab-shell","issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"builds_enabled":true,"snippets_enabled":false,"created_at":"2016-01-13T20:19:51.882Z","last_activity_at":"2016-01-13T20:27:35.678Z","shared_runners_enabled":true,"creator_id":1,"namespace":{"id":3,"name":"Gitlab Org","path":"gitlab-org","owner_id":null,"created_at":"2016-01-13T20:19:48.851Z","updated_at":"2016-01-13T20:19:48.851Z","description":"Magni mollitia quod quidem soluta nesciunt impedit.","avatar":{"url":null}},"avatar_url":null,"star_count":0,"forks_count":0,"only_allow_merge_if_build_succeeds":false,"open_issues_count":5,"permissions":{"project_access":{"access_level":20,"notification_level":3},"group_access":{"access_level":50,"notification_level":3}}},{"id":3,"description":"Excepturi molestiae quia repellendus omnis est illo illum eligendi.","default_branch":"master","tag_list":[],"public":true,"archived":false,"visibility_level":20,"ssh_url_to_repo":"phil@localhost:gitlab-org/gitlab-ci.git","http_url_to_repo":"http://localhost:3000/gitlab-org/gitlab-ci.git","web_url":"http://localhost:3000/gitlab-org/gitlab-ci","name":"Gitlab Ci","name_with_namespace":"Gitlab Org / Gitlab Ci","path":"gitlab-ci","path_with_namespace":"gitlab-org/gitlab-ci","issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"builds_enabled":true,"snippets_enabled":false,"created_at":"2016-01-13T20:19:50.346Z","last_activity_at":"2016-01-13T20:27:30.115Z","shared_runners_enabled":true,"creator_id":1,"namespace":{"id":3,"name":"Gitlab Org","path":"gitlab-org","owner_id":null,"created_at":"2016-01-13T20:19:48.851Z","updated_at":"2016-01-13T20:19:48.851Z","description":"Magni mollitia quod quidem soluta nesciunt impedit.","avatar":{"url":null}},"avatar_url":null,"star_count":0,"forks_count":0,"only_allow_merge_if_build_succeeds":false,"open_issues_count":3,"permissions":{"project_access":null,"group_access":{"access_level":50,"notification_level":3}}},{"id":2,"description":"Adipisci quaerat dignissimos enim sed ipsam dolorem quia.","default_branch":"master","tag_list":[],"public":false,"archived":false,"visibility_level":10,"ssh_url_to_repo":"phil@localhost:gitlab-org/gitlab-ce.git","http_url_to_repo":"http://localhost:3000/gitlab-org/gitlab-ce.git","web_url":"http://localhost:3000/gitlab-org/gitlab-ce","name":"Gitlab Ce","name_with_namespace":"Gitlab Org / Gitlab Ce","path":"gitlab-ce","path_with_namespace":"gitlab-org/gitlab-ce","issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"builds_enabled":true,"snippets_enabled":false,"created_at":"2016-01-13T20:19:49.065Z","last_activity_at":"2016-01-13T20:26:58.454Z","shared_runners_enabled":true,"creator_id":1,"namespace":{"id":3,"name":"Gitlab Org","path":"gitlab-org","owner_id":null,"created_at":"2016-01-13T20:19:48.851Z","updated_at":"2016-01-13T20:19:48.851Z","description":"Magni mollitia quod quidem soluta nesciunt impedit.","avatar":{"url":null}},"avatar_url":null,"star_count":0,"forks_count":0,"only_allow_merge_if_build_succeeds":false,"open_issues_count":5,"permissions":{"project_access":{"access_level":30,"notification_level":3},"group_access":{"access_level":50,"notification_level":3}}},{"id":1,"description":"Vel voluptatem maxime saepe ex quia.","default_branch":"master","tag_list":[],"public":false,"archived":false,"visibility_level":0,"ssh_url_to_repo":"phil@localhost:documentcloud/underscore.git","http_url_to_repo":"http://localhost:3000/documentcloud/underscore.git","web_url":"http://localhost:3000/documentcloud/underscore","name":"Underscore","name_with_namespace":"Documentcloud / Underscore","path":"underscore","path_with_namespace":"documentcloud/underscore","issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"builds_enabled":true,"snippets_enabled":false,"created_at":"2016-01-13T20:19:45.862Z","last_activity_at":"2016-01-13T20:25:03.106Z","shared_runners_enabled":true,"creator_id":1,"namespace":{"id":2,"name":"Documentcloud","path":"documentcloud","owner_id":null,"created_at":"2016-01-13T20:19:44.464Z","updated_at":"2016-01-13T20:19:44.464Z","description":"Aut impedit perferendis fuga et ipsa repellat cupiditate et.","avatar":{"url":null}},"avatar_url":null,"star_count":0,"forks_count":0,"only_allow_merge_if_build_succeeds":false,"open_issues_count":5,"permissions":{"project_access":null,"group_access":{"access_level":50,"notification_level":3}}}] +[{ + "id": 9, + "description": "", + "default_branch": null, + "tag_list": [], + "public": true, + "archived": false, + "visibility_level": 20, + "ssh_url_to_repo": "phil@localhost:root/test.git", + "http_url_to_repo": "http://localhost:3000/root/test.git", + "web_url": "http://localhost:3000/root/test", + "owner": { + "name": "Administrator", + "username": "root", + "id": 1, + "state": "active", + "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon", + "web_url": "http://localhost:3000/u/root" + }, + "name": "test", + "name_with_namespace": "Administrator / test", + "path": "test", + "path_with_namespace": "root/test", + "issues_enabled": true, + "merge_requests_enabled": true, + "wiki_enabled": true, + "builds_enabled": true, + "snippets_enabled": false, + "created_at": "2016-01-14T19:08:05.364Z", + "last_activity_at": "2016-01-14T19:08:07.418Z", + "shared_runners_enabled": true, + "creator_id": 1, + "namespace": { + "id": 1, + "name": "root", + "path": "root", + "owner_id": 1, + "created_at": "2016-01-13T20:19:44.439Z", + "updated_at": "2016-01-13T20:19:44.439Z", + "description": "", + "avatar": null + }, + "avatar_url": null, + "star_count": 0, + "forks_count": 0, + "only_allow_merge_if_build_succeeds": false, + "open_issues_count": 0, + "permissions": { + "project_access": null, + "group_access": null + } +}, { + "id": 8, + "description": "Voluptatem quae nulla eius numquam ullam voluptatibus quia modi.", + "default_branch": "master", + "tag_list": [], + "public": false, + "archived": false, + "visibility_level": 0, + "ssh_url_to_repo": "phil@localhost:h5bp/html5-boilerplate.git", + "http_url_to_repo": "http://localhost:3000/h5bp/html5-boilerplate.git", + "web_url": "http://localhost:3000/h5bp/html5-boilerplate", + "name": "Html5 Boilerplate", + "name_with_namespace": "H5bp / Html5 Boilerplate", + "path": "html5-boilerplate", + "path_with_namespace": "h5bp/html5-boilerplate", + "issues_enabled": true, + "merge_requests_enabled": true, + "wiki_enabled": true, + "builds_enabled": true, + "snippets_enabled": false, + "created_at": "2016-01-13T20:19:57.525Z", + "last_activity_at": "2016-01-13T20:27:57.280Z", + "shared_runners_enabled": true, + "creator_id": 1, + "namespace": { + "id": 5, + "name": "H5bp", + "path": "h5bp", + "owner_id": null, + "created_at": "2016-01-13T20:19:57.239Z", + "updated_at": "2016-01-13T20:19:57.239Z", + "description": "Tempore accusantium possimus aut libero.", + "avatar": { + "url": null + } + }, + "avatar_url": null, + "star_count": 0, + "forks_count": 0, + "only_allow_merge_if_build_succeeds": false, + "open_issues_count": 5, + "permissions": { + "project_access": { + "access_level": 10, + "notification_level": 3 + }, + "group_access": { + "access_level": 50, + "notification_level": 3 + } + } +}, { + "id": 7, + "description": "Modi odio mollitia dolorem qui.", + "default_branch": "master", + "tag_list": [], + "public": false, + "archived": false, + "visibility_level": 0, + "ssh_url_to_repo": "phil@localhost:twitter/typeahead-js.git", + "http_url_to_repo": "http://localhost:3000/twitter/typeahead-js.git", + "web_url": "http://localhost:3000/twitter/typeahead-js", + "name": "Typeahead.Js", + "name_with_namespace": "Twitter / Typeahead.Js", + "path": "typeahead-js", + "path_with_namespace": "twitter/typeahead-js", + "issues_enabled": true, + "merge_requests_enabled": true, + "wiki_enabled": true, + "builds_enabled": true, + "snippets_enabled": false, + "created_at": "2016-01-13T20:19:56.212Z", + "last_activity_at": "2016-01-13T20:27:51.496Z", + "shared_runners_enabled": true, + "creator_id": 1, + "namespace": { + "id": 4, + "name": "Twitter", + "path": "twitter", + "owner_id": null, + "created_at": "2016-01-13T20:19:54.480Z", + "updated_at": "2016-01-13T20:19:54.480Z", + "description": "Id voluptatem ipsa maiores omnis repudiandae et et.", + "avatar": { + "url": null + } + }, + "avatar_url": null, + "star_count": 0, + "forks_count": 0, + "only_allow_merge_if_build_succeeds": true, + "open_issues_count": 4, + "permissions": { + "project_access": null, + "group_access": { + "access_level": 10, + "notification_level": 3 + } + } +}, { + "id": 6, + "description": "Omnis asperiores ipsa et beatae quidem necessitatibus quia.", + "default_branch": "master", + "tag_list": [], + "public": true, + "archived": false, + "visibility_level": 20, + "ssh_url_to_repo": "phil@localhost:twitter/flight.git", + "http_url_to_repo": "http://localhost:3000/twitter/flight.git", + "web_url": "http://localhost:3000/twitter/flight", + "name": "Flight", + "name_with_namespace": "Twitter / Flight", + "path": "flight", + "path_with_namespace": "twitter/flight", + "issues_enabled": true, + "merge_requests_enabled": true, + "wiki_enabled": true, + "builds_enabled": true, + "snippets_enabled": false, + "created_at": "2016-01-13T20:19:54.754Z", + "last_activity_at": "2016-01-13T20:27:50.502Z", + "shared_runners_enabled": true, + "creator_id": 1, + "namespace": { + "id": 4, + "name": "Twitter", + "path": "twitter", + "owner_id": null, + "created_at": "2016-01-13T20:19:54.480Z", + "updated_at": "2016-01-13T20:19:54.480Z", + "description": "Id voluptatem ipsa maiores omnis repudiandae et et.", + "avatar": { + "url": null + } + }, + "avatar_url": null, + "star_count": 0, + "forks_count": 0, + "only_allow_merge_if_build_succeeds": true, + "open_issues_count": 4, + "permissions": { + "project_access": null, + "group_access": { + "access_level": 10, + "notification_level": 3 + } + } +}, { + "id": 5, + "description": "Voluptatem commodi voluptate placeat architecto beatae illum dolores fugiat.", + "default_branch": "master", + "tag_list": [], + "public": false, + "archived": false, + "visibility_level": 0, + "ssh_url_to_repo": "phil@localhost:gitlab-org/gitlab-test.git", + "http_url_to_repo": "http://localhost:3000/gitlab-org/gitlab-test.git", + "web_url": "http://localhost:3000/gitlab-org/gitlab-test", + "name": "Gitlab Test", + "name_with_namespace": "Gitlab Org / Gitlab Test", + "path": "gitlab-test", + "path_with_namespace": "gitlab-org/gitlab-test", + "issues_enabled": true, + "merge_requests_enabled": true, + "wiki_enabled": true, + "builds_enabled": true, + "snippets_enabled": false, + "created_at": "2016-01-13T20:19:53.202Z", + "last_activity_at": "2016-01-13T20:27:41.626Z", + "shared_runners_enabled": true, + "creator_id": 1, + "namespace": { + "id": 3, + "name": "Gitlab Org", + "path": "gitlab-org", + "owner_id": null, + "created_at": "2016-01-13T20:19:48.851Z", + "updated_at": "2016-01-13T20:19:48.851Z", + "description": "Magni mollitia quod quidem soluta nesciunt impedit.", + "avatar": { + "url": null + } + }, + "avatar_url": null, + "star_count": 0, + "forks_count": 0, + "only_allow_merge_if_build_succeeds": false, + "open_issues_count": 5, + "permissions": { + "project_access": null, + "group_access": { + "access_level": 50, + "notification_level": 3 + } + } +}, { + "id": 4, + "description": "Aut molestias quas est ut aperiam officia quod libero.", + "default_branch": "master", + "tag_list": [], + "public": true, + "archived": false, + "visibility_level": 20, + "ssh_url_to_repo": "phil@localhost:gitlab-org/gitlab-shell.git", + "http_url_to_repo": "http://localhost:3000/gitlab-org/gitlab-shell.git", + "web_url": "http://localhost:3000/gitlab-org/gitlab-shell", + "name": "Gitlab Shell", + "name_with_namespace": "Gitlab Org / Gitlab Shell", + "path": "gitlab-shell", + "path_with_namespace": "gitlab-org/gitlab-shell", + "issues_enabled": true, + "merge_requests_enabled": true, + "wiki_enabled": true, + "builds_enabled": true, + "snippets_enabled": false, + "created_at": "2016-01-13T20:19:51.882Z", + "last_activity_at": "2016-01-13T20:27:35.678Z", + "shared_runners_enabled": true, + "creator_id": 1, + "namespace": { + "id": 3, + "name": "Gitlab Org", + "path": "gitlab-org", + "owner_id": null, + "created_at": "2016-01-13T20:19:48.851Z", + "updated_at": "2016-01-13T20:19:48.851Z", + "description": "Magni mollitia quod quidem soluta nesciunt impedit.", + "avatar": { + "url": null + } + }, + "avatar_url": null, + "star_count": 0, + "forks_count": 0, + "only_allow_merge_if_build_succeeds": false, + "open_issues_count": 5, + "permissions": { + "project_access": { + "access_level": 20, + "notification_level": 3 + }, + "group_access": { + "access_level": 50, + "notification_level": 3 + } + } +}, { + "id": 3, + "description": "Excepturi molestiae quia repellendus omnis est illo illum eligendi.", + "default_branch": "master", + "tag_list": [], + "public": true, + "archived": false, + "visibility_level": 20, + "ssh_url_to_repo": "phil@localhost:gitlab-org/gitlab-ci.git", + "http_url_to_repo": "http://localhost:3000/gitlab-org/gitlab-ci.git", + "web_url": "http://localhost:3000/gitlab-org/gitlab-ci", + "name": "Gitlab Ci", + "name_with_namespace": "Gitlab Org / Gitlab Ci", + "path": "gitlab-ci", + "path_with_namespace": "gitlab-org/gitlab-ci", + "issues_enabled": true, + "merge_requests_enabled": true, + "wiki_enabled": true, + "builds_enabled": true, + "snippets_enabled": false, + "created_at": "2016-01-13T20:19:50.346Z", + "last_activity_at": "2016-01-13T20:27:30.115Z", + "shared_runners_enabled": true, + "creator_id": 1, + "namespace": { + "id": 3, + "name": "Gitlab Org", + "path": "gitlab-org", + "owner_id": null, + "created_at": "2016-01-13T20:19:48.851Z", + "updated_at": "2016-01-13T20:19:48.851Z", + "description": "Magni mollitia quod quidem soluta nesciunt impedit.", + "avatar": { + "url": null + } + }, + "avatar_url": null, + "star_count": 0, + "forks_count": 0, + "only_allow_merge_if_build_succeeds": false, + "open_issues_count": 3, + "permissions": { + "project_access": null, + "group_access": { + "access_level": 50, + "notification_level": 3 + } + } +}, { + "id": 2, + "description": "Adipisci quaerat dignissimos enim sed ipsam dolorem quia.", + "default_branch": "master", + "tag_list": [], + "public": false, + "archived": false, + "visibility_level": 10, + "ssh_url_to_repo": "phil@localhost:gitlab-org/gitlab-ce.git", + "http_url_to_repo": "http://localhost:3000/gitlab-org/gitlab-ce.git", + "web_url": "http://localhost:3000/gitlab-org/gitlab-ce", + "name": "Gitlab Ce", + "name_with_namespace": "Gitlab Org / Gitlab Ce", + "path": "gitlab-ce", + "path_with_namespace": "gitlab-org/gitlab-ce", + "issues_enabled": true, + "merge_requests_enabled": true, + "wiki_enabled": true, + "builds_enabled": true, + "snippets_enabled": false, + "created_at": "2016-01-13T20:19:49.065Z", + "last_activity_at": "2016-01-13T20:26:58.454Z", + "shared_runners_enabled": true, + "creator_id": 1, + "namespace": { + "id": 3, + "name": "Gitlab Org", + "path": "gitlab-org", + "owner_id": null, + "created_at": "2016-01-13T20:19:48.851Z", + "updated_at": "2016-01-13T20:19:48.851Z", + "description": "Magni mollitia quod quidem soluta nesciunt impedit.", + "avatar": { + "url": null + } + }, + "avatar_url": null, + "star_count": 0, + "forks_count": 0, + "only_allow_merge_if_build_succeeds": false, + "open_issues_count": 5, + "permissions": { + "project_access": { + "access_level": 30, + "notification_level": 3 + }, + "group_access": { + "access_level": 50, + "notification_level": 3 + } + } +}, { + "id": 1, + "description": "Vel voluptatem maxime saepe ex quia.", + "default_branch": "master", + "tag_list": [], + "public": false, + "archived": false, + "visibility_level": 0, + "ssh_url_to_repo": "phil@localhost:documentcloud/underscore.git", + "http_url_to_repo": "http://localhost:3000/documentcloud/underscore.git", + "web_url": "http://localhost:3000/documentcloud/underscore", + "name": "Underscore", + "name_with_namespace": "Documentcloud / Underscore", + "path": "underscore", + "path_with_namespace": "documentcloud/underscore", + "issues_enabled": true, + "merge_requests_enabled": true, + "wiki_enabled": true, + "builds_enabled": true, + "snippets_enabled": false, + "created_at": "2016-01-13T20:19:45.862Z", + "last_activity_at": "2016-01-13T20:25:03.106Z", + "shared_runners_enabled": true, + "creator_id": 1, + "namespace": { + "id": 2, + "name": "Documentcloud", + "path": "documentcloud", + "owner_id": null, + "created_at": "2016-01-13T20:19:44.464Z", + "updated_at": "2016-01-13T20:19:44.464Z", + "description": "Aut impedit perferendis fuga et ipsa repellat cupiditate et.", + "avatar": { + "url": null + } + }, + "avatar_url": null, + "star_count": 0, + "forks_count": 0, + "only_allow_merge_if_build_succeeds": false, + "open_issues_count": 5, + "permissions": { + "project_access": null, + "group_access": { + "access_level": 50, + "notification_level": 3 + } + } +}] From 5997a86e680e22454522819e1b959d18cad48d1f Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Mon, 2 Jan 2017 13:04:10 -0600 Subject: [PATCH 7/9] add CHANGELOG entry for !8384 --- ...nerate-all-haml-fixtures-within-teaspoon-fixtures-task.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/unreleased/26226-generate-all-haml-fixtures-within-teaspoon-fixtures-task.yml diff --git a/changelogs/unreleased/26226-generate-all-haml-fixtures-within-teaspoon-fixtures-task.yml b/changelogs/unreleased/26226-generate-all-haml-fixtures-within-teaspoon-fixtures-task.yml new file mode 100644 index 00000000000..28981291132 --- /dev/null +++ b/changelogs/unreleased/26226-generate-all-haml-fixtures-within-teaspoon-fixtures-task.yml @@ -0,0 +1,4 @@ +--- +title: Precompile all JavaScript fixtures +merge_request: 8384 +author: From 7a2a9bb45e681fdcd707fdbe3fbcc3ce2e17663c Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 30 Dec 2016 18:14:33 -0600 Subject: [PATCH 8/9] replace Teaspoon fixture methods with jasmine-jquery methods to reduce dependency on Teaspoon --- spec/javascripts/.eslintrc | 23 +++++++++++++++---- spec/javascripts/abuse_reports_spec.js.es6 | 4 ++-- spec/javascripts/activities_spec.js.es6 | 2 +- spec/javascripts/awards_handler_spec.js | 4 ++-- spec/javascripts/behaviors/autosize_spec.js | 2 +- .../behaviors/quick_submit_spec.js | 4 ++-- .../behaviors/requires_input_spec.js | 4 ++-- .../bootstrap_linked_tabs_spec.js.es6 | 4 ++-- spec/javascripts/build_spec.js.es6 | 4 ++-- spec/javascripts/dashboard_spec.js.es6 | 4 ++-- .../environment_actions_spec.js.es6 | 4 ++-- .../environment_external_url_spec.js.es6 | 4 ++-- .../environments/environment_item_spec.js.es6 | 4 ++-- .../environment_rollback_spec.js.es6 | 4 ++-- .../environments/environment_stop_spec.js.es6 | 4 ++-- spec/javascripts/extensions/jquery_spec.js | 4 ++-- spec/javascripts/gl_dropdown_spec.js.es6 | 7 +++--- spec/javascripts/gl_field_errors_spec.js.es6 | 4 ++-- spec/javascripts/header_spec.js | 4 ++-- spec/javascripts/issuable_spec.js.es6 | 6 ++--- spec/javascripts/issue_spec.js | 12 +++++----- .../labels_issue_sidebar_spec.js.es6 | 4 ++-- spec/javascripts/line_highlighter_spec.js | 4 ++-- spec/javascripts/merge_request_spec.js | 4 ++-- spec/javascripts/merge_request_tabs_spec.js | 4 ++-- .../mini_pipeline_graph_dropdown_spec.js.es6 | 4 ++-- spec/javascripts/new_branch_spec.js | 4 ++-- spec/javascripts/notes_spec.js | 4 ++-- spec/javascripts/pipelines_spec.js.es6 | 4 ++-- spec/javascripts/project_title_spec.js | 7 +++--- spec/javascripts/right_sidebar_spec.js | 6 ++--- spec/javascripts/search_autocomplete_spec.js | 4 ++-- spec/javascripts/shortcuts_issuable_spec.js | 4 ++-- .../signin_tabs_memoizer_spec.js.es6 | 4 ++-- spec/javascripts/smart_interval_spec.js.es6 | 2 +- spec/javascripts/spec_helper.js | 10 ++++---- spec/javascripts/syntax_highlight_spec.js | 6 ++--- spec/javascripts/u2f/authenticate_spec.js | 4 ++-- spec/javascripts/u2f/register_spec.js | 4 ++-- .../vue_common_components/commit_spec.js.es6 | 6 ++--- spec/javascripts/zen_mode_spec.js | 4 ++-- 41 files changed, 108 insertions(+), 97 deletions(-) diff --git a/spec/javascripts/.eslintrc b/spec/javascripts/.eslintrc index 7792acffac2..dcbcd014dc3 100644 --- a/spec/javascripts/.eslintrc +++ b/spec/javascripts/.eslintrc @@ -1,15 +1,28 @@ { - "plugins": ["jasmine"], "env": { "jasmine": true }, "extends": "plugin:jasmine/recommended", + "globals": { + "appendLoadFixtures": false, + "appendLoadStyleFixtures": false, + "appendSetFixtures": false, + "appendSetStyleFixtures": false, + "getJSONFixture": false, + "loadFixtures": false, + "loadJSONFixtures": false, + "loadStyleFixtures": false, + "preloadFixtures": false, + "preloadStyleFixtures": false, + "readFixtures": false, + "sandbox": false, + "setFixtures": false, + "setStyleFixtures": false, + "spyOnEvent": false + }, + "plugins": ["jasmine"], "rules": { "prefer-arrow-callback": 0, "func-names": 0 - }, - "globals": { - "fixture": false, - "spyOnEvent": false } } diff --git a/spec/javascripts/abuse_reports_spec.js.es6 b/spec/javascripts/abuse_reports_spec.js.es6 index 49e56249565..cf19aa05031 100644 --- a/spec/javascripts/abuse_reports_spec.js.es6 +++ b/spec/javascripts/abuse_reports_spec.js.es6 @@ -13,10 +13,10 @@ (index, element) => element.innerText.indexOf(searchText) > -1, ).first(); - fixture.preload(FIXTURE); + preloadFixtures(FIXTURE); beforeEach(function () { - fixture.load(FIXTURE); + loadFixtures(FIXTURE); this.abuseReports = new global.AbuseReports(); messages = $('.abuse-reports .message'); }); diff --git a/spec/javascripts/activities_spec.js.es6 b/spec/javascripts/activities_spec.js.es6 index f0138945637..b3617a45bd4 100644 --- a/spec/javascripts/activities_spec.js.es6 +++ b/spec/javascripts/activities_spec.js.es6 @@ -35,7 +35,7 @@ describe('Activities', () => { beforeEach(() => { - fixture.load(fixtureTemplate); + loadFixtures(fixtureTemplate); new gl.Activities(); }); diff --git a/spec/javascripts/awards_handler_spec.js b/spec/javascripts/awards_handler_spec.js index 89201c8cb8b..faba2837d41 100644 --- a/spec/javascripts/awards_handler_spec.js +++ b/spec/javascripts/awards_handler_spec.js @@ -34,9 +34,9 @@ }; describe('AwardsHandler', function() { - fixture.preload('issues/open-issue.html.raw'); + preloadFixtures('issues/open-issue.html.raw'); beforeEach(function() { - fixture.load('issues/open-issue.html.raw'); + loadFixtures('issues/open-issue.html.raw'); awardsHandler = new AwardsHandler; spyOn(awardsHandler, 'postEmoji').and.callFake((function(_this) { return function(url, emoji, cb) { diff --git a/spec/javascripts/behaviors/autosize_spec.js b/spec/javascripts/behaviors/autosize_spec.js index b4573e53a4e..e77d732a32a 100644 --- a/spec/javascripts/behaviors/autosize_spec.js +++ b/spec/javascripts/behaviors/autosize_spec.js @@ -6,7 +6,7 @@ describe('Autosize behavior', function() { var load; beforeEach(function() { - return fixture.set(''); + return setFixtures(''); }); it('does not overwrite the resize property', function() { load(); diff --git a/spec/javascripts/behaviors/quick_submit_spec.js b/spec/javascripts/behaviors/quick_submit_spec.js index f4a977b9dea..1a1f34cfdc0 100644 --- a/spec/javascripts/behaviors/quick_submit_spec.js +++ b/spec/javascripts/behaviors/quick_submit_spec.js @@ -5,9 +5,9 @@ (function() { describe('Quick Submit behavior', function() { var keydownEvent; - fixture.preload('static/behaviors/quick_submit.html.raw'); + preloadFixtures('static/behaviors/quick_submit.html.raw'); beforeEach(function() { - fixture.load('static/behaviors/quick_submit.html.raw'); + loadFixtures('static/behaviors/quick_submit.html.raw'); $('form').submit(function(e) { // Prevent a form submit from moving us off the testing page return e.preventDefault(); diff --git a/spec/javascripts/behaviors/requires_input_spec.js b/spec/javascripts/behaviors/requires_input_spec.js index 8b21551bd10..1f62591c06d 100644 --- a/spec/javascripts/behaviors/requires_input_spec.js +++ b/spec/javascripts/behaviors/requires_input_spec.js @@ -4,9 +4,9 @@ (function() { describe('requiresInput', function() { - fixture.preload('static/behaviors/requires_input.html.raw'); + preloadFixtures('static/behaviors/requires_input.html.raw'); beforeEach(function() { - return fixture.load('static/behaviors/requires_input.html.raw'); + return loadFixtures('static/behaviors/requires_input.html.raw'); }); it('disables submit when any field is required', function() { $('.js-requires-input').requiresInput(); diff --git a/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 b/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 index e5256520c24..ea953d0f5a5 100644 --- a/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 +++ b/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 @@ -2,10 +2,10 @@ (() => { describe('Linked Tabs', () => { - fixture.preload('static/linked_tabs.html.raw'); + preloadFixtures('static/linked_tabs.html.raw'); beforeEach(() => { - fixture.load('static/linked_tabs.html.raw'); + loadFixtures('static/linked_tabs.html.raw'); }); describe('when is initialized', () => { diff --git a/spec/javascripts/build_spec.js.es6 b/spec/javascripts/build_spec.js.es6 index 3983cad4c13..0c556382980 100644 --- a/spec/javascripts/build_spec.js.es6 +++ b/spec/javascripts/build_spec.js.es6 @@ -17,10 +17,10 @@ describe('Build', () => { offset: BUILD_TRACE.length, n_open_tags: 0, fg_color: null, bg_color: null, style_mask: 0, })); - fixture.preload('builds/build-with-artifacts.html.raw'); + preloadFixtures('builds/build-with-artifacts.html.raw'); beforeEach(() => { - fixture.load('builds/build-with-artifacts.html.raw'); + loadFixtures('builds/build-with-artifacts.html.raw'); spyOn($, 'ajax'); }); diff --git a/spec/javascripts/dashboard_spec.js.es6 b/spec/javascripts/dashboard_spec.js.es6 index 76fe4878519..3f6b328348d 100644 --- a/spec/javascripts/dashboard_spec.js.es6 +++ b/spec/javascripts/dashboard_spec.js.es6 @@ -17,9 +17,9 @@ $(document).trigger('todo:toggle', newCount); } - fixture.preload(fixtureTemplate); + preloadFixtures(fixtureTemplate); beforeEach(() => { - fixture.load(fixtureTemplate); + loadFixtures(fixtureTemplate); new global.Sidebar(); }); diff --git a/spec/javascripts/environments/environment_actions_spec.js.es6 b/spec/javascripts/environments/environment_actions_spec.js.es6 index c2ac3523483..056e4d41e93 100644 --- a/spec/javascripts/environments/environment_actions_spec.js.es6 +++ b/spec/javascripts/environments/environment_actions_spec.js.es6 @@ -2,10 +2,10 @@ //= require environments/components/environment_actions describe('Actions Component', () => { - fixture.preload('static/environments/element.html.raw'); + preloadFixtures('static/environments/element.html.raw'); beforeEach(() => { - fixture.load('static/environments/element.html.raw'); + loadFixtures('static/environments/element.html.raw'); }); it('should render a dropdown with the provided actions', () => { diff --git a/spec/javascripts/environments/environment_external_url_spec.js.es6 b/spec/javascripts/environments/environment_external_url_spec.js.es6 index d578a017d44..950a5d53fad 100644 --- a/spec/javascripts/environments/environment_external_url_spec.js.es6 +++ b/spec/javascripts/environments/environment_external_url_spec.js.es6 @@ -2,9 +2,9 @@ //= require environments/components/environment_external_url describe('External URL Component', () => { - fixture.preload('static/environments/element.html.raw'); + preloadFixtures('static/environments/element.html.raw'); beforeEach(() => { - fixture.load('static/environments/element.html.raw'); + loadFixtures('static/environments/element.html.raw'); }); it('should link to the provided externalUrl prop', () => { diff --git a/spec/javascripts/environments/environment_item_spec.js.es6 b/spec/javascripts/environments/environment_item_spec.js.es6 index 7b53152108f..c178b9cc1ec 100644 --- a/spec/javascripts/environments/environment_item_spec.js.es6 +++ b/spec/javascripts/environments/environment_item_spec.js.es6 @@ -3,9 +3,9 @@ //= require environments/components/environment_item describe('Environment item', () => { - fixture.preload('static/environments/table.html.raw'); + preloadFixtures('static/environments/table.html.raw'); beforeEach(() => { - fixture.load('static/environments/table.html.raw'); + loadFixtures('static/environments/table.html.raw'); }); describe('When item is folder', () => { diff --git a/spec/javascripts/environments/environment_rollback_spec.js.es6 b/spec/javascripts/environments/environment_rollback_spec.js.es6 index bfa20d6f2e5..21241116e29 100644 --- a/spec/javascripts/environments/environment_rollback_spec.js.es6 +++ b/spec/javascripts/environments/environment_rollback_spec.js.es6 @@ -1,12 +1,12 @@ //= require vue //= require environments/components/environment_rollback describe('Rollback Component', () => { - fixture.preload('static/environments/element.html.raw'); + preloadFixtures('static/environments/element.html.raw'); const retryURL = 'https://gitlab.com/retry'; beforeEach(() => { - fixture.load('static/environments/element.html.raw'); + loadFixtures('static/environments/element.html.raw'); }); it('Should link to the provided retryUrl', () => { diff --git a/spec/javascripts/environments/environment_stop_spec.js.es6 b/spec/javascripts/environments/environment_stop_spec.js.es6 index c3c5f2cc4c8..bb998a32f32 100644 --- a/spec/javascripts/environments/environment_stop_spec.js.es6 +++ b/spec/javascripts/environments/environment_stop_spec.js.es6 @@ -1,13 +1,13 @@ //= require vue //= require environments/components/environment_stop describe('Stop Component', () => { - fixture.preload('static/environments/element.html.raw'); + preloadFixtures('static/environments/element.html.raw'); let stopURL; let component; beforeEach(() => { - fixture.load('static/environments/element.html.raw'); + loadFixtures('static/environments/element.html.raw'); stopURL = '/stop'; component = new window.gl.environmentsList.StopComponent({ diff --git a/spec/javascripts/extensions/jquery_spec.js b/spec/javascripts/extensions/jquery_spec.js index 76309930f27..91846bb9143 100644 --- a/spec/javascripts/extensions/jquery_spec.js +++ b/spec/javascripts/extensions/jquery_spec.js @@ -6,7 +6,7 @@ describe('jQuery extensions', function() { describe('disable', function() { beforeEach(function() { - return fixture.set(''); + return setFixtures(''); }); it('adds the disabled attribute', function() { var $input; @@ -23,7 +23,7 @@ }); return describe('enable', function() { beforeEach(function() { - return fixture.set(''); + return setFixtures(''); }); it('removes the disabled attribute', function() { var $input; diff --git a/spec/javascripts/gl_dropdown_spec.js.es6 b/spec/javascripts/gl_dropdown_spec.js.es6 index 5f9359007ac..ce96571bd52 100644 --- a/spec/javascripts/gl_dropdown_spec.js.es6 +++ b/spec/javascripts/gl_dropdown_spec.js.es6 @@ -43,8 +43,7 @@ } describe('Dropdown', function describeDropdown() { - fixture.preload('static/gl_dropdown.html.raw'); - fixture.preload('projects.json'); + preloadFixtures('static/gl_dropdown.html.raw'); function initDropDown(hasRemote, isFilterable) { this.dropdownButtonElement = $('#js-project-dropdown', this.dropdownContainerElement).glDropdown({ @@ -61,10 +60,10 @@ } beforeEach(() => { - fixture.load('static/gl_dropdown.html.raw'); + loadFixtures('static/gl_dropdown.html.raw'); this.dropdownContainerElement = $('.dropdown.inline'); this.$dropdownMenuElement = $('.dropdown-menu', this.dropdownContainerElement); - this.projectsData = fixture.load('projects.json')[0]; + this.projectsData = getJSONFixture('projects.json'); }); afterEach(() => { diff --git a/spec/javascripts/gl_field_errors_spec.js.es6 b/spec/javascripts/gl_field_errors_spec.js.es6 index d314b23a7ed..e5d934540af 100644 --- a/spec/javascripts/gl_field_errors_spec.js.es6 +++ b/spec/javascripts/gl_field_errors_spec.js.es6 @@ -4,11 +4,11 @@ //= require gl_field_errors ((global) => { - fixture.preload('static/gl_field_errors.html.raw'); + preloadFixtures('static/gl_field_errors.html.raw'); describe('GL Style Field Errors', function() { beforeEach(function() { - fixture.load('static/gl_field_errors.html.raw'); + loadFixtures('static/gl_field_errors.html.raw'); const $form = this.$form = $('form.gl-show-field-errors'); this.fieldErrors = new global.GlFieldErrors($form); }); diff --git a/spec/javascripts/header_spec.js b/spec/javascripts/header_spec.js index b413a3357f3..b5262afa1cf 100644 --- a/spec/javascripts/header_spec.js +++ b/spec/javascripts/header_spec.js @@ -17,9 +17,9 @@ $(document).trigger('todo:toggle', newCount); } - fixture.preload(fixtureTemplate); + preloadFixtures(fixtureTemplate); beforeEach(function() { - fixture.load(fixtureTemplate); + loadFixtures(fixtureTemplate); }); it('should update todos-pending-count after receiving the todo:toggle event', function() { diff --git a/spec/javascripts/issuable_spec.js.es6 b/spec/javascripts/issuable_spec.js.es6 index 846a3907c3d..917a6267b92 100644 --- a/spec/javascripts/issuable_spec.js.es6 +++ b/spec/javascripts/issuable_spec.js.es6 @@ -21,10 +21,10 @@ } describe('Issuable', () => { - fixture.preload('static/issuable_filter.html.raw'); + preloadFixtures('static/issuable_filter.html.raw'); beforeEach(() => { - fixture.load('static/issuable_filter.html.raw'); + loadFixtures('static/issuable_filter.html.raw'); Issuable.init(); }); @@ -37,7 +37,7 @@ beforeEach(() => { $filtersForm = $('.js-filter-form'); - fixture.load('static/issuable_filter.html.raw'); + loadFixtures('static/issuable_filter.html.raw'); resetForm($filtersForm); }); diff --git a/spec/javascripts/issue_spec.js b/spec/javascripts/issue_spec.js index 421936a4786..eb07421826c 100644 --- a/spec/javascripts/issue_spec.js +++ b/spec/javascripts/issue_spec.js @@ -8,9 +8,9 @@ var INVALID_URL = 'http://goesnowhere.nothing/whereami'; var $boxClosed, $boxOpen, $btnClose, $btnReopen; - fixture.preload('issues/closed-issue.html.raw'); - fixture.preload('issues/issue-with-task-list.html.raw'); - fixture.preload('issues/open-issue.html.raw'); + preloadFixtures('issues/closed-issue.html.raw'); + preloadFixtures('issues/issue-with-task-list.html.raw'); + preloadFixtures('issues/open-issue.html.raw'); function expectErrorMessage() { var $flashMessage = $('div.flash-alert'); @@ -61,8 +61,8 @@ describe('Issue', function() { describe('task lists', function() { - fixture.load('issues/issue-with-task-list.html.raw'); beforeEach(function() { + loadFixtures('issues/issue-with-task-list.html.raw'); this.issue = new Issue(); }); @@ -86,7 +86,7 @@ describe('close issue', function() { beforeEach(function() { - fixture.load('issues/open-issue.html.raw'); + loadFixtures('issues/open-issue.html.raw'); findElements(); this.issue = new Issue(); @@ -140,7 +140,7 @@ describe('reopen issue', function() { beforeEach(function() { - fixture.load('issues/closed-issue.html.raw'); + loadFixtures('issues/closed-issue.html.raw'); findElements(); this.issue = new Issue(); diff --git a/spec/javascripts/labels_issue_sidebar_spec.js.es6 b/spec/javascripts/labels_issue_sidebar_spec.js.es6 index de788ef7027..e3146559a4a 100644 --- a/spec/javascripts/labels_issue_sidebar_spec.js.es6 +++ b/spec/javascripts/labels_issue_sidebar_spec.js.es6 @@ -17,10 +17,10 @@ (() => { let saveLabelCount = 0; describe('Issue dropdown sidebar', () => { - fixture.preload('static/issue_sidebar_label.html.raw'); + preloadFixtures('static/issue_sidebar_label.html.raw'); beforeEach(() => { - fixture.load('static/issue_sidebar_label.html.raw'); + loadFixtures('static/issue_sidebar_label.html.raw'); new IssuableContext('{"id":1,"name":"Administrator","username":"root"}'); new LabelsSelect(); diff --git a/spec/javascripts/line_highlighter_spec.js b/spec/javascripts/line_highlighter_spec.js index 15f2c0e6ed4..31f516b41bf 100644 --- a/spec/javascripts/line_highlighter_spec.js +++ b/spec/javascripts/line_highlighter_spec.js @@ -6,7 +6,7 @@ (function() { describe('LineHighlighter', function() { var clickLine; - fixture.preload('static/line_highlighter.html.raw'); + preloadFixtures('static/line_highlighter.html.raw'); clickLine = function(number, eventData) { var e; if (eventData == null) { @@ -20,7 +20,7 @@ } }; beforeEach(function() { - fixture.load('static/line_highlighter.html.raw'); + loadFixtures('static/line_highlighter.html.raw'); this["class"] = new LineHighlighter(); this.css = this["class"].highlightClass; return this.spies = { diff --git a/spec/javascripts/merge_request_spec.js b/spec/javascripts/merge_request_spec.js index 68afb4af3c1..9b232617fe5 100644 --- a/spec/javascripts/merge_request_spec.js +++ b/spec/javascripts/merge_request_spec.js @@ -6,9 +6,9 @@ (function() { describe('MergeRequest', function() { return describe('task lists', function() { - fixture.preload('static/merge_requests_show.html.raw'); + preloadFixtures('static/merge_requests_show.html.raw'); beforeEach(function() { - fixture.load('static/merge_requests_show.html.raw'); + loadFixtures('static/merge_requests_show.html.raw'); return this.merge = new MergeRequest(); }); it('modifies the Markdown field', function() { diff --git a/spec/javascripts/merge_request_tabs_spec.js b/spec/javascripts/merge_request_tabs_spec.js index 1104f123b25..98201fb98ed 100644 --- a/spec/javascripts/merge_request_tabs_spec.js +++ b/spec/javascripts/merge_request_tabs_spec.js @@ -16,7 +16,7 @@ }; $.extend(stubLocation, defaults, stubs || {}); }; - fixture.preload('static/merge_request_tabs.html.raw'); + preloadFixtures('static/merge_request_tabs.html.raw'); beforeEach(function () { this.class = new gl.MergeRequestTabs({ stubLocation: stubLocation }); @@ -30,7 +30,7 @@ describe('#activateTab', function () { beforeEach(function () { spyOn($, 'ajax').and.callFake(function () {}); - fixture.load('static/merge_request_tabs.html.raw'); + loadFixtures('static/merge_request_tabs.html.raw'); this.subject = this.class.activateTab; }); it('shows the first tab when action is show', function () { diff --git a/spec/javascripts/mini_pipeline_graph_dropdown_spec.js.es6 b/spec/javascripts/mini_pipeline_graph_dropdown_spec.js.es6 index 0cbfce8fbab..a1c2fe3df37 100644 --- a/spec/javascripts/mini_pipeline_graph_dropdown_spec.js.es6 +++ b/spec/javascripts/mini_pipeline_graph_dropdown_spec.js.es6 @@ -5,10 +5,10 @@ (() => { describe('Mini Pipeline Graph Dropdown', () => { - fixture.preload('static/mini_dropdown_graph.html.raw'); + preloadFixtures('static/mini_dropdown_graph.html.raw'); beforeEach(() => { - fixture.load('static/mini_dropdown_graph.html.raw'); + loadFixtures('static/mini_dropdown_graph.html.raw'); }); describe('When is initialized', () => { diff --git a/spec/javascripts/new_branch_spec.js b/spec/javascripts/new_branch_spec.js index ba2c6f419e9..e0dc549a9f4 100644 --- a/spec/javascripts/new_branch_spec.js +++ b/spec/javascripts/new_branch_spec.js @@ -8,7 +8,7 @@ describe('Branch', function() { return describe('create a new branch', function() { var expectToHaveError, fillNameWith; - fixture.preload('static/new_branch.html.raw'); + preloadFixtures('static/new_branch.html.raw'); fillNameWith = function(value) { return $('.js-branch-name').val(value).trigger('blur'); }; @@ -16,7 +16,7 @@ return expect($('.js-branch-name-error span').text()).toEqual(error); }; beforeEach(function() { - fixture.load('static/new_branch.html.raw'); + loadFixtures('static/new_branch.html.raw'); $('form').on('submit', function(e) { return e.preventDefault(); }); diff --git a/spec/javascripts/notes_spec.js b/spec/javascripts/notes_spec.js index 5ea50ce43f7..f0f71fe6ca8 100644 --- a/spec/javascripts/notes_spec.js +++ b/spec/javascripts/notes_spec.js @@ -13,10 +13,10 @@ describe('Notes', function() { var commentsTemplate = 'issues/issue_with_comment.html.raw'; - fixture.preload(commentsTemplate); + preloadFixtures(commentsTemplate); beforeEach(function () { - fixture.load(commentsTemplate); + loadFixtures(commentsTemplate); gl.utils.disableButtonIfEmptyField = _.noop; window.project_uploads_path = 'http://test.host/uploads'; }); diff --git a/spec/javascripts/pipelines_spec.js.es6 b/spec/javascripts/pipelines_spec.js.es6 index 27b9c4a2e28..f0f9ad7430d 100644 --- a/spec/javascripts/pipelines_spec.js.es6 +++ b/spec/javascripts/pipelines_spec.js.es6 @@ -2,10 +2,10 @@ (() => { describe('Pipelines', () => { - fixture.preload('static/pipeline_graph.html.raw'); + preloadFixtures('static/pipeline_graph.html.raw'); beforeEach(() => { - fixture.load('static/pipeline_graph.html.raw'); + loadFixtures('static/pipeline_graph.html.raw'); }); it('should be defined', () => { diff --git a/spec/javascripts/project_title_spec.js b/spec/javascripts/project_title_spec.js index 677094f2c9d..27b071f266d 100644 --- a/spec/javascripts/project_title_spec.js +++ b/spec/javascripts/project_title_spec.js @@ -16,10 +16,9 @@ window.gon.api_version = 'v3'; describe('Project Title', function() { - fixture.preload('static/project_title.html.raw'); - fixture.preload('projects.json'); + preloadFixtures('static/project_title.html.raw'); beforeEach(function() { - fixture.load('static/project_title.html.raw'); + loadFixtures('static/project_title.html.raw'); return this.project = new Project(); }); return describe('project list', function() { @@ -34,7 +33,7 @@ beforeEach((function(_this) { return function() { - _this.projects_data = fixture.load('projects.json')[0]; + _this.projects_data = getJSONFixture('projects.json'); return spyOn(jQuery, 'ajax').and.callFake(fakeAjaxResponse.bind(_this)); }; })(this)); diff --git a/spec/javascripts/right_sidebar_spec.js b/spec/javascripts/right_sidebar_spec.js index a083dbf033a..b2ee0ce5963 100644 --- a/spec/javascripts/right_sidebar_spec.js +++ b/spec/javascripts/right_sidebar_spec.js @@ -36,9 +36,9 @@ describe('RightSidebar', function() { var fixtureName = 'issues/open-issue.html.raw'; - fixture.preload(fixtureName); + preloadFixtures(fixtureName); beforeEach(function() { - fixture.load(fixtureName); + loadFixtures(fixtureName); this.sidebar = new Sidebar; $aside = $('.right-sidebar'); $page = $('.page-with-sidebar'); @@ -67,7 +67,7 @@ it('should broadcast todo:toggle event when add todo clicked', function() { spyOn(jQuery, 'ajax').and.callFake(function() { var d = $.Deferred(); - var response = fixture.load('todos.json'); + var response = getJSONFixture('todos.json'); d.resolve(response); return d.promise(); }); diff --git a/spec/javascripts/search_autocomplete_spec.js b/spec/javascripts/search_autocomplete_spec.js index b6e7815c6cc..e13c4ad772c 100644 --- a/spec/javascripts/search_autocomplete_spec.js +++ b/spec/javascripts/search_autocomplete_spec.js @@ -112,9 +112,9 @@ }; describe('Search autocomplete dropdown', function() { - fixture.preload('static/search_autocomplete.html.raw'); + preloadFixtures('static/search_autocomplete.html.raw'); beforeEach(function() { - fixture.load('static/search_autocomplete.html.raw'); + loadFixtures('static/search_autocomplete.html.raw'); return widget = new gl.SearchAutocomplete; }); it('should show Dashboard specific dropdown menu', function() { diff --git a/spec/javascripts/shortcuts_issuable_spec.js b/spec/javascripts/shortcuts_issuable_spec.js index 7bc898aed5d..ae5d639ad9c 100644 --- a/spec/javascripts/shortcuts_issuable_spec.js +++ b/spec/javascripts/shortcuts_issuable_spec.js @@ -6,9 +6,9 @@ (function() { describe('ShortcutsIssuable', function() { var fixtureName = 'issues/open-issue.html.raw'; - fixture.preload(fixtureName); + preloadFixtures(fixtureName); beforeEach(function() { - fixture.load(fixtureName); + loadFixtures(fixtureName); document.querySelector('.js-new-note-form').classList.add('js-main-target-form'); return this.shortcut = new ShortcutsIssuable(); }); diff --git a/spec/javascripts/signin_tabs_memoizer_spec.js.es6 b/spec/javascripts/signin_tabs_memoizer_spec.js.es6 index 416a5b1aafb..c274b9c45f4 100644 --- a/spec/javascripts/signin_tabs_memoizer_spec.js.es6 +++ b/spec/javascripts/signin_tabs_memoizer_spec.js.es6 @@ -15,10 +15,10 @@ return memo; } - fixture.preload(fixtureTemplate); + preloadFixtures(fixtureTemplate); beforeEach(() => { - fixture.load(fixtureTemplate); + loadFixtures(fixtureTemplate); }); it('does nothing if no tab was previously selected', () => { diff --git a/spec/javascripts/smart_interval_spec.js.es6 b/spec/javascripts/smart_interval_spec.js.es6 index 1b7ca97cde4..39d236986b9 100644 --- a/spec/javascripts/smart_interval_spec.js.es6 +++ b/spec/javascripts/smart_interval_spec.js.es6 @@ -103,7 +103,7 @@ describe('DOM Events', function () { beforeEach(function () { // This ensures DOM and DOM events are initialized for these specs. - fixture.set('
'); + setFixtures('
'); this.smartInterval = createDefaultSmartInterval(); }); diff --git a/spec/javascripts/spec_helper.js b/spec/javascripts/spec_helper.js index 831dfada952..f8e3aca29fa 100644 --- a/spec/javascripts/spec_helper.js +++ b/spec/javascripts/spec_helper.js @@ -37,12 +37,12 @@ // file as a manifest. // For more information: http://github.com/modeset/teaspoon -(function() { - - -}).call(this); +// set our fixtures path +jasmine.getFixtures().fixturesPath = '/teaspoon/fixtures'; +jasmine.getJSONFixtures().fixturesPath = '/teaspoon/fixtures'; // defined in ActionDispatch::TestRequest // see https://github.com/rails/rails/blob/v4.2.7.1/actionpack/lib/action_dispatch/testing/test_request.rb#L7 window.gl = window.gl || {}; -gl.TEST_HOST = 'http://test.host'; +window.gl.TEST_HOST = 'http://test.host'; +window.gon = window.gon || {}; diff --git a/spec/javascripts/syntax_highlight_spec.js b/spec/javascripts/syntax_highlight_spec.js index ac411f6c306..5984ce8ffd4 100644 --- a/spec/javascripts/syntax_highlight_spec.js +++ b/spec/javascripts/syntax_highlight_spec.js @@ -13,7 +13,7 @@ }; describe('on a js-syntax-highlight element', function() { beforeEach(function() { - return fixture.set('
'); + return setFixtures('
'); }); return it('applies syntax highlighting', function() { stubUserColorScheme('monokai'); @@ -23,7 +23,7 @@ }); return describe('on a parent element', function() { beforeEach(function() { - return fixture.set("
\n
\n
\n
\n
"); + return setFixtures("
\n
\n
\n
\n
"); }); it('applies highlighting to all applicable children', function() { stubUserColorScheme('monokai'); @@ -33,7 +33,7 @@ }); return it('prevents an infinite loop when no matches exist', function() { var highlight; - fixture.set('
'); + setFixtures('
'); highlight = function() { return $('div').syntaxHighlight(); }; diff --git a/spec/javascripts/u2f/authenticate_spec.js b/spec/javascripts/u2f/authenticate_spec.js index f6399b22865..dc2f4967985 100644 --- a/spec/javascripts/u2f/authenticate_spec.js +++ b/spec/javascripts/u2f/authenticate_spec.js @@ -10,10 +10,10 @@ (function() { describe('U2FAuthenticate', function() { - fixture.preload('u2f/authenticate.html.raw'); + preloadFixtures('u2f/authenticate.html.raw'); beforeEach(function() { - fixture.load('u2f/authenticate.html.raw'); + loadFixtures('u2f/authenticate.html.raw'); this.u2fDevice = new MockU2FDevice; this.container = $("#js-authenticate-u2f"); this.component = new window.gl.U2FAuthenticate( diff --git a/spec/javascripts/u2f/register_spec.js b/spec/javascripts/u2f/register_spec.js index 7eda2ac4c24..ab4c5edd044 100644 --- a/spec/javascripts/u2f/register_spec.js +++ b/spec/javascripts/u2f/register_spec.js @@ -10,10 +10,10 @@ (function() { describe('U2FRegister', function() { - fixture.preload('u2f/register.html.raw'); + preloadFixtures('u2f/register.html.raw'); beforeEach(function() { - fixture.load('u2f/register.html.raw'); + loadFixtures('u2f/register.html.raw'); this.u2fDevice = new MockU2FDevice; this.container = $("#js-register-u2f"); this.component = new U2FRegister(this.container, $("#js-register-u2f-templates"), {}, "token"); diff --git a/spec/javascripts/vue_common_components/commit_spec.js.es6 b/spec/javascripts/vue_common_components/commit_spec.js.es6 index 26dfdb94aae..d6c6f786fb1 100644 --- a/spec/javascripts/vue_common_components/commit_spec.js.es6 +++ b/spec/javascripts/vue_common_components/commit_spec.js.es6 @@ -5,7 +5,7 @@ describe('Commit component', () => { let component; it('should render a code-fork icon if it does not represent a tag', () => { - fixture.set('
'); + setFixtures('
'); component = new window.gl.CommitComponent({ el: document.querySelector('.test-commit-container'), propsData: { @@ -30,7 +30,7 @@ describe('Commit component', () => { describe('Given all the props', () => { beforeEach(() => { - fixture.set('
'); + setFixtures('
'); props = { tag: true, @@ -105,7 +105,7 @@ describe('Commit component', () => { describe('When commit title is not provided', () => { it('should render default message', () => { - fixture.set('
'); + setFixtures('
'); props = { tag: false, commitRef: { diff --git a/spec/javascripts/zen_mode_spec.js b/spec/javascripts/zen_mode_spec.js index d80ce5a7f7e..64ccfdc9f18 100644 --- a/spec/javascripts/zen_mode_spec.js +++ b/spec/javascripts/zen_mode_spec.js @@ -10,9 +10,9 @@ describe('ZenMode', function() { var fixtureName = 'issues/open-issue.html.raw'; - fixture.preload(fixtureName); + preloadFixtures(fixtureName); beforeEach(function() { - fixture.load(fixtureName); + loadFixtures(fixtureName); spyOn(Dropzone, 'forElement').and.callFake(function() { return { enable: function() { From f19330e4fbef7f893af86c6e9b06d3378c3ef936 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Tue, 3 Jan 2017 16:38:53 -0600 Subject: [PATCH 9/9] fix right_sidebar_spec ajax call --- spec/javascripts/right_sidebar_spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/javascripts/right_sidebar_spec.js b/spec/javascripts/right_sidebar_spec.js index b2ee0ce5963..0177d8e4e79 100644 --- a/spec/javascripts/right_sidebar_spec.js +++ b/spec/javascripts/right_sidebar_spec.js @@ -65,9 +65,10 @@ }); it('should broadcast todo:toggle event when add todo clicked', function() { + var todos = getJSONFixture('todos.json'); spyOn(jQuery, 'ajax').and.callFake(function() { var d = $.Deferred(); - var response = getJSONFixture('todos.json'); + var response = todos; d.resolve(response); return d.promise(); });