Commit c2eab5a4 authored by Mike Greiling's avatar Mike Greiling

Port of 26226-generate-all-haml-fixtures-within-teaspoon-fixtures-task to EE

Squashed commit of the following:

commit f19330e4
Author: Mike Greiling <mike@pixelcog.com>
Date:   Tue Jan 3 16:38:53 2017 -0600

    fix right_sidebar_spec ajax call

commit 7a2a9bb4
Author: Mike Greiling <mike@pixelcog.com>
Date:   Fri Dec 30 18:14:33 2016 -0600

    replace Teaspoon fixture methods with jasmine-jquery methods to reduce dependency on Teaspoon

commit 10d483ea
Merge: 5997a86e df5223de
Author: Mike Greiling <mike@pixelcog.com>
Date:   Thu Jan 5 14:10:43 2017 -0600

    Merge branch 'fix-u2f-fixtures' into 26226-generate-all-haml-fixtures-within-teaspoon-fixtures-task

    * fix-u2f-fixtures:
      generate u2f frontend fixtures dynamically
      force utf-8 encoding for prior to fixture parsing to prevent nokogiri issues
      exclude script type=text/template from dom scrubbing

commit df5223de
Author: Mike Greiling <mike@pixelcog.com>
Date:   Tue Jan 3 14:48:37 2017 -0600

    generate u2f frontend fixtures dynamically

commit 8cee3b1d
Author: Mike Greiling <mike@pixelcog.com>
Date:   Tue Jan 3 15:26:14 2017 -0600

    force utf-8 encoding for prior to fixture parsing to prevent nokogiri issues

commit ca404170
Author: Mike Greiling <mike@pixelcog.com>
Date:   Tue Jan 3 10:46:17 2017 -0600

    exclude script type=text/template from dom scrubbing

commit 5997a86e
Author: Mike Greiling <mike@pixelcog.com>
Date:   Mon Jan 2 13:04:10 2017 -0600

    add CHANGELOG entry for !8384

commit d904335d
Author: Mike Greiling <mike@pixelcog.com>
Date:   Fri Dec 30 18:25:23 2016 -0600

    make projects.json easier to read

commit 7ae2fe13
Author: Mike Greiling <mike@pixelcog.com>
Date:   Fri Dec 30 17:28:51 2016 -0600

    fix dynamic u2f fixtures

commit 5f192c77
Author: Mike Greiling <mike@pixelcog.com>
Date:   Fri Dec 30 15:27:40 2016 -0600

    update all frontend tests to point to precompiled fixtures

commit 6370e326
Author: Mike Greiling <mike@pixelcog.com>
Date:   Fri Dec 30 14:50:07 2016 -0600

    recursively clean compiled fixtures

commit 2373082e
Author: Mike Greiling <mike@pixelcog.com>
Date:   Fri Dec 30 14:47:12 2016 -0600

    create catch-all fixture generator for all static fixtures

commit 4cd962ec
Author: Mike Greiling <mike@pixelcog.com>
Date:   Fri Dec 30 14:46:41 2016 -0600

    allow storage of raw string fixtures
parent c913163d
---
title: Precompile all JavaScript fixtures
merge_request: 8384
author:
{ {
"plugins": ["jasmine"],
"env": { "env": {
"jasmine": true "jasmine": true
}, },
"extends": "plugin:jasmine/recommended", "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": { "rules": {
"prefer-arrow-callback": 0, "prefer-arrow-callback": 0,
"func-names": 0 "func-names": 0
},
"globals": {
"fixture": false,
"spyOnEvent": false
} }
} }
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
(index, element) => element.innerText.indexOf(searchText) > -1, (index, element) => element.innerText.indexOf(searchText) > -1,
).first(); ).first();
fixture.preload(FIXTURE); preloadFixtures(FIXTURE);
beforeEach(function () { beforeEach(function () {
fixture.load(FIXTURE); loadFixtures(FIXTURE);
this.abuseReports = new global.AbuseReports(); this.abuseReports = new global.AbuseReports();
messages = $('.abuse-reports .message'); messages = $('.abuse-reports .message');
}); });
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
(() => { (() => {
window.gon || (window.gon = {}); window.gon || (window.gon = {});
const fixtureTemplate = 'event_filter.html'; const fixtureTemplate = 'static/event_filter.html.raw';
const filters = [ const filters = [
{ {
id: 'all', id: 'all',
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
describe('Activities', () => { describe('Activities', () => {
beforeEach(() => { beforeEach(() => {
fixture.load(fixtureTemplate); loadFixtures(fixtureTemplate);
new gl.Activities(); new gl.Activities();
}); });
......
...@@ -34,9 +34,9 @@ ...@@ -34,9 +34,9 @@
}; };
describe('AwardsHandler', function() { describe('AwardsHandler', function() {
fixture.preload('issues/open-issue.html.raw'); preloadFixtures('issues/open-issue.html.raw');
beforeEach(function() { beforeEach(function() {
fixture.load('issues/open-issue.html.raw'); loadFixtures('issues/open-issue.html.raw');
awardsHandler = new AwardsHandler; awardsHandler = new AwardsHandler;
spyOn(awardsHandler, 'postEmoji').and.callFake((function(_this) { spyOn(awardsHandler, 'postEmoji').and.callFake((function(_this) {
return function(url, emoji, cb) { return function(url, emoji, cb) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
describe('Autosize behavior', function() { describe('Autosize behavior', function() {
var load; var load;
beforeEach(function() { beforeEach(function() {
return fixture.set('<textarea class="js-autosize" style="resize: vertical"></textarea>'); return setFixtures('<textarea class="js-autosize" style="resize: vertical"></textarea>');
}); });
it('does not overwrite the resize property', function() { it('does not overwrite the resize property', function() {
load(); load();
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
(function() { (function() {
describe('Quick Submit behavior', function() { describe('Quick Submit behavior', function() {
var keydownEvent; var keydownEvent;
fixture.preload('behaviors/quick_submit.html'); preloadFixtures('static/behaviors/quick_submit.html.raw');
beforeEach(function() { beforeEach(function() {
fixture.load('behaviors/quick_submit.html'); loadFixtures('static/behaviors/quick_submit.html.raw');
$('form').submit(function(e) { $('form').submit(function(e) {
// Prevent a form submit from moving us off the testing page // Prevent a form submit from moving us off the testing page
return e.preventDefault(); return e.preventDefault();
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
(function() { (function() {
describe('requiresInput', function() { describe('requiresInput', function() {
fixture.preload('behaviors/requires_input.html'); preloadFixtures('static/behaviors/requires_input.html.raw');
beforeEach(function() { beforeEach(function() {
return fixture.load('behaviors/requires_input.html'); return loadFixtures('static/behaviors/requires_input.html.raw');
}); });
it('disables submit when any field is required', function() { it('disables submit when any field is required', function() {
$('.js-requires-input').requiresInput(); $('.js-requires-input').requiresInput();
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
(() => { (() => {
describe('Linked Tabs', () => { describe('Linked Tabs', () => {
fixture.preload('linked_tabs'); preloadFixtures('static/linked_tabs.html.raw');
beforeEach(() => { beforeEach(() => {
fixture.load('linked_tabs'); loadFixtures('static/linked_tabs.html.raw');
}); });
describe('when is initialized', () => { describe('when is initialized', () => {
......
...@@ -17,10 +17,10 @@ describe('Build', () => { ...@@ -17,10 +17,10 @@ describe('Build', () => {
offset: BUILD_TRACE.length, n_open_tags: 0, fg_color: null, bg_color: null, style_mask: 0, 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(() => { beforeEach(() => {
fixture.load('builds/build-with-artifacts.html.raw'); loadFixtures('builds/build-with-artifacts.html.raw');
spyOn($, 'ajax'); spyOn($, 'ajax');
}); });
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
((global) => { ((global) => {
describe('Dashboard', () => { describe('Dashboard', () => {
const fixtureTemplate = 'dashboard.html'; const fixtureTemplate = 'static/dashboard.html.raw';
function todosCountText() { function todosCountText() {
return $('.js-todos-count').text(); return $('.js-todos-count').text();
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
$(document).trigger('todo:toggle', newCount); $(document).trigger('todo:toggle', newCount);
} }
fixture.preload(fixtureTemplate); preloadFixtures(fixtureTemplate);
beforeEach(() => { beforeEach(() => {
fixture.load(fixtureTemplate); loadFixtures(fixtureTemplate);
new global.Sidebar(); new global.Sidebar();
}); });
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
//= require environments/components/environment_actions //= require environments/components/environment_actions
describe('Actions Component', () => { describe('Actions Component', () => {
fixture.preload('environments/element.html'); preloadFixtures('static/environments/element.html.raw');
beforeEach(() => { beforeEach(() => {
fixture.load('environments/element.html'); loadFixtures('static/environments/element.html.raw');
}); });
it('should render a dropdown with the provided actions', () => { it('should render a dropdown with the provided actions', () => {
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
//= require environments/components/environment_external_url //= require environments/components/environment_external_url
describe('External URL Component', () => { describe('External URL Component', () => {
fixture.preload('environments/element.html'); preloadFixtures('static/environments/element.html.raw');
beforeEach(() => { beforeEach(() => {
fixture.load('environments/element.html'); loadFixtures('static/environments/element.html.raw');
}); });
it('should link to the provided externalUrl prop', () => { it('should link to the provided externalUrl prop', () => {
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
//= require environments/components/environment_item //= require environments/components/environment_item
describe('Environment item', () => { describe('Environment item', () => {
fixture.preload('environments/table.html'); preloadFixtures('static/environments/table.html.raw');
beforeEach(() => { beforeEach(() => {
fixture.load('environments/table.html'); loadFixtures('static/environments/table.html.raw');
}); });
describe('When item is folder', () => { describe('When item is folder', () => {
......
//= require vue //= require vue
//= require environments/components/environment_rollback //= require environments/components/environment_rollback
describe('Rollback Component', () => { describe('Rollback Component', () => {
fixture.preload('environments/element.html'); preloadFixtures('static/environments/element.html.raw');
const retryURL = 'https://gitlab.com/retry'; const retryURL = 'https://gitlab.com/retry';
beforeEach(() => { beforeEach(() => {
fixture.load('environments/element.html'); loadFixtures('static/environments/element.html.raw');
}); });
it('Should link to the provided retryUrl', () => { it('Should link to the provided retryUrl', () => {
......
//= require vue //= require vue
//= require environments/components/environment_stop //= require environments/components/environment_stop
describe('Stop Component', () => { describe('Stop Component', () => {
fixture.preload('environments/element.html'); preloadFixtures('static/environments/element.html.raw');
let stopURL; let stopURL;
let component; let component;
beforeEach(() => { beforeEach(() => {
fixture.load('environments/element.html'); loadFixtures('static/environments/element.html.raw');
stopURL = '/stop'; stopURL = '/stop';
component = new window.gl.environmentsList.StopComponent({ component = new window.gl.environmentsList.StopComponent({
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
describe('jQuery extensions', function() { describe('jQuery extensions', function() {
describe('disable', function() { describe('disable', function() {
beforeEach(function() { beforeEach(function() {
return fixture.set('<input type="text" />'); return setFixtures('<input type="text" />');
}); });
it('adds the disabled attribute', function() { it('adds the disabled attribute', function() {
var $input; var $input;
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
}); });
return describe('enable', function() { return describe('enable', function() {
beforeEach(function() { beforeEach(function() {
return fixture.set('<input type="text" disabled="disabled" class="disabled" />'); return setFixtures('<input type="text" disabled="disabled" class="disabled" />');
}); });
it('removes the disabled attribute', function() { it('removes the disabled attribute', function() {
var $input; var $input;
......
[{"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
}
}
}]
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
require 'spec_helper'
context 'U2F' do
include JavaScriptFixturesHelpers
let(:user) { create(:user, :two_factor_via_u2f) }
before(:all) do
clean_frontend_fixtures('u2f/')
end
describe SessionsController, '(JavaScript fixtures)', type: :controller do
render_views
before do
@request.env['devise.mapping'] = Devise.mappings[:user]
end
it 'u2f/authenticate.html.raw' do |example|
allow(controller).to receive(:find_user).and_return(user)
post :create, user: { login: user.username, password: user.password }
expect(response).to be_success
store_frontend_fixture(response, example.description)
end
end
describe Profiles::TwoFactorAuthsController, '(JavaScript fixtures)', type: :controller do
render_views
before do
sign_in(user)
end
it 'u2f/register.html.raw' do |example|
get :show
expect(response).to be_success
store_frontend_fixture(response, example.description)
end
end
end
= render partial: "u2f/authenticate", locals: { new_user_session_path: "/users/sign_in", params: {}, resource_name: "user" }
- 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 }
...@@ -43,8 +43,7 @@ ...@@ -43,8 +43,7 @@
} }
describe('Dropdown', function describeDropdown() { describe('Dropdown', function describeDropdown() {
fixture.preload('gl_dropdown.html'); preloadFixtures('static/gl_dropdown.html.raw');
fixture.preload('projects.json');
function initDropDown(hasRemote, isFilterable) { function initDropDown(hasRemote, isFilterable) {
this.dropdownButtonElement = $('#js-project-dropdown', this.dropdownContainerElement).glDropdown({ this.dropdownButtonElement = $('#js-project-dropdown', this.dropdownContainerElement).glDropdown({
...@@ -61,10 +60,10 @@ ...@@ -61,10 +60,10 @@
} }
beforeEach(() => { beforeEach(() => {
fixture.load('gl_dropdown.html'); loadFixtures('static/gl_dropdown.html.raw');
this.dropdownContainerElement = $('.dropdown.inline'); this.dropdownContainerElement = $('.dropdown.inline');
this.$dropdownMenuElement = $('.dropdown-menu', this.dropdownContainerElement); this.$dropdownMenuElement = $('.dropdown-menu', this.dropdownContainerElement);
this.projectsData = fixture.load('projects.json')[0]; this.projectsData = getJSONFixture('projects.json');
}); });
afterEach(() => { afterEach(() => {
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
//= require gl_field_errors //= require gl_field_errors
((global) => { ((global) => {
fixture.preload('gl_field_errors.html'); preloadFixtures('static/gl_field_errors.html.raw');
describe('GL Style Field Errors', function() { describe('GL Style Field Errors', function() {
beforeEach(function() { beforeEach(function() {
fixture.load('gl_field_errors.html'); loadFixtures('static/gl_field_errors.html.raw');
const $form = this.$form = $('form.gl-show-field-errors'); const $form = this.$form = $('form.gl-show-field-errors');
this.fieldErrors = new global.GlFieldErrors($form); this.fieldErrors = new global.GlFieldErrors($form);
}); });
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
describe('Header', function() { describe('Header', function() {
var todosPendingCount = '.todos-pending-count'; var todosPendingCount = '.todos-pending-count';
var fixtureTemplate = 'header.html'; var fixtureTemplate = 'static/header.html.raw';
function isTodosCountHidden() { function isTodosCountHidden() {
return $(todosPendingCount).hasClass('hidden'); return $(todosPendingCount).hasClass('hidden');
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
$(document).trigger('todo:toggle', newCount); $(document).trigger('todo:toggle', newCount);
} }
fixture.preload(fixtureTemplate); preloadFixtures(fixtureTemplate);
beforeEach(function() { beforeEach(function() {
fixture.load(fixtureTemplate); loadFixtures(fixtureTemplate);
}); });
it('should update todos-pending-count after receiving the todo:toggle event', function() { it('should update todos-pending-count after receiving the todo:toggle event', function() {
......
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
} }
describe('Issuable', () => { describe('Issuable', () => {
fixture.preload('issuable_filter'); preloadFixtures('static/issuable_filter.html.raw');
beforeEach(() => { beforeEach(() => {
fixture.load('issuable_filter'); loadFixtures('static/issuable_filter.html.raw');
Issuable.init(); Issuable.init();
}); });
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
beforeEach(() => { beforeEach(() => {
$filtersForm = $('.js-filter-form'); $filtersForm = $('.js-filter-form');
fixture.load('issuable_filter'); loadFixtures('static/issuable_filter.html.raw');
resetForm($filtersForm); resetForm($filtersForm);
}); });
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
//= require issuable/time_tracking/components/time_tracker //= require issuable/time_tracking/components/time_tracker
function initTimeTrackingComponent(opts) { function initTimeTrackingComponent(opts) {
fixture.set(` setFixtures(`
<div> <div>
<div id="mock-container"></div> <div id="mock-container"></div>
</div> </div>
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
var INVALID_URL = 'http://goesnowhere.nothing/whereami'; var INVALID_URL = 'http://goesnowhere.nothing/whereami';
var $boxClosed, $boxOpen, $btnClose, $btnReopen; var $boxClosed, $boxOpen, $btnClose, $btnReopen;
fixture.preload('issues/closed-issue.html'); preloadFixtures('issues/closed-issue.html.raw');
fixture.preload('issues/issue-with-task-list.html'); preloadFixtures('issues/issue-with-task-list.html.raw');
fixture.preload('issues/open-issue.html'); preloadFixtures('issues/open-issue.html.raw');
function expectErrorMessage() { function expectErrorMessage() {
var $flashMessage = $('div.flash-alert'); var $flashMessage = $('div.flash-alert');
...@@ -61,8 +61,8 @@ ...@@ -61,8 +61,8 @@
describe('Issue', function() { describe('Issue', function() {
describe('task lists', function() { describe('task lists', function() {
fixture.load('issues/issue-with-task-list.html');
beforeEach(function() { beforeEach(function() {
loadFixtures('issues/issue-with-task-list.html.raw');
this.issue = new Issue(); this.issue = new Issue();
}); });
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
describe('close issue', function() { describe('close issue', function() {
beforeEach(function() { beforeEach(function() {
fixture.load('issues/open-issue.html'); loadFixtures('issues/open-issue.html.raw');
findElements(); findElements();
this.issue = new Issue(); this.issue = new Issue();
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
describe('reopen issue', function() { describe('reopen issue', function() {
beforeEach(function() { beforeEach(function() {
fixture.load('issues/closed-issue.html'); loadFixtures('issues/closed-issue.html.raw');
findElements(); findElements();
this.issue = new Issue(); this.issue = new Issue();
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
(() => { (() => {
let saveLabelCount = 0; let saveLabelCount = 0;
describe('Issue dropdown sidebar', () => { describe('Issue dropdown sidebar', () => {
fixture.preload('issue_sidebar_label.html'); preloadFixtures('static/issue_sidebar_label.html.raw');
beforeEach(() => { beforeEach(() => {
fixture.load('issue_sidebar_label.html'); loadFixtures('static/issue_sidebar_label.html.raw');
new IssuableContext('{"id":1,"name":"Administrator","username":"root"}'); new IssuableContext('{"id":1,"name":"Administrator","username":"root"}');
new LabelsSelect(); new LabelsSelect();
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
(function() { (function() {
describe('LineHighlighter', function() { describe('LineHighlighter', function() {
var clickLine; var clickLine;
fixture.preload('line_highlighter.html'); preloadFixtures('static/line_highlighter.html.raw');
clickLine = function(number, eventData) { clickLine = function(number, eventData) {
var e; var e;
if (eventData == null) { if (eventData == null) {
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
} }
}; };
beforeEach(function() { beforeEach(function() {
fixture.load('line_highlighter.html'); loadFixtures('static/line_highlighter.html.raw');
this["class"] = new LineHighlighter(); this["class"] = new LineHighlighter();
this.css = this["class"].highlightClass; this.css = this["class"].highlightClass;
return this.spies = { return this.spies = {
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
(function() { (function() {
describe('MergeRequest', function() { describe('MergeRequest', function() {
return describe('task lists', function() { return describe('task lists', function() {
fixture.preload('merge_requests_show.html'); preloadFixtures('static/merge_requests_show.html.raw');
beforeEach(function() { beforeEach(function() {
fixture.load('merge_requests_show.html'); loadFixtures('static/merge_requests_show.html.raw');
return this.merge = new MergeRequest(); return this.merge = new MergeRequest();
}); });
it('modifies the Markdown field', function() { it('modifies the Markdown field', function() {
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
}; };
$.extend(stubLocation, defaults, stubs || {}); $.extend(stubLocation, defaults, stubs || {});
}; };
fixture.preload('merge_request_tabs.html'); preloadFixtures('static/merge_request_tabs.html.raw');
beforeEach(function () { beforeEach(function () {
this.class = new gl.MergeRequestTabs({ stubLocation: stubLocation }); this.class = new gl.MergeRequestTabs({ stubLocation: stubLocation });
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
describe('#activateTab', function () { describe('#activateTab', function () {
beforeEach(function () { beforeEach(function () {
spyOn($, 'ajax').and.callFake(function () {}); spyOn($, 'ajax').and.callFake(function () {});
fixture.load('merge_request_tabs.html'); loadFixtures('static/merge_request_tabs.html.raw');
this.subject = this.class.activateTab; this.subject = this.class.activateTab;
}); });
it('shows the first tab when action is show', function () { it('shows the first tab when action is show', function () {
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
(() => { (() => {
describe('Mini Pipeline Graph Dropdown', () => { describe('Mini Pipeline Graph Dropdown', () => {
fixture.preload('mini_dropdown_graph'); preloadFixtures('static/mini_dropdown_graph.html.raw');
beforeEach(() => { beforeEach(() => {
fixture.load('mini_dropdown_graph'); loadFixtures('static/mini_dropdown_graph.html.raw');
}); });
describe('When is initialized', () => { describe('When is initialized', () => {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
describe('Branch', function() { describe('Branch', function() {
return describe('create a new branch', function() { return describe('create a new branch', function() {
var expectToHaveError, fillNameWith; var expectToHaveError, fillNameWith;
fixture.preload('new_branch.html'); preloadFixtures('static/new_branch.html.raw');
fillNameWith = function(value) { fillNameWith = function(value) {
return $('.js-branch-name').val(value).trigger('blur'); return $('.js-branch-name').val(value).trigger('blur');
}; };
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
return expect($('.js-branch-name-error span').text()).toEqual(error); return expect($('.js-branch-name-error span').text()).toEqual(error);
}; };
beforeEach(function() { beforeEach(function() {
fixture.load('new_branch.html'); loadFixtures('static/new_branch.html.raw');
$('form').on('submit', function(e) { $('form').on('submit', function(e) {
return e.preventDefault(); return e.preventDefault();
}); });
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
gl.utils = gl.utils || {}; gl.utils = gl.utils || {};
describe('Notes', function() { describe('Notes', function() {
var commentsTemplate = 'issues/issue_with_comment.raw'; var commentsTemplate = 'issues/issue_with_comment.html.raw';
fixture.preload(commentsTemplate); preloadFixtures(commentsTemplate);
beforeEach(function () { beforeEach(function () {
fixture.load(commentsTemplate); loadFixtures(commentsTemplate);
gl.utils.disableButtonIfEmptyField = _.noop; gl.utils.disableButtonIfEmptyField = _.noop;
window.project_uploads_path = 'http://test.host/uploads'; window.project_uploads_path = 'http://test.host/uploads';
}); });
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
(() => { (() => {
describe('Pipelines', () => { describe('Pipelines', () => {
fixture.preload('pipeline_graph'); preloadFixtures('static/pipeline_graph.html.raw');
beforeEach(() => { beforeEach(() => {
fixture.load('pipeline_graph'); loadFixtures('static/pipeline_graph.html.raw');
}); });
it('should be defined', () => { it('should be defined', () => {
......
...@@ -16,10 +16,9 @@ ...@@ -16,10 +16,9 @@
window.gon.api_version = 'v3'; window.gon.api_version = 'v3';
describe('Project Title', function() { describe('Project Title', function() {
fixture.preload('project_title.html'); preloadFixtures('static/project_title.html.raw');
fixture.preload('projects.json');
beforeEach(function() { beforeEach(function() {
fixture.load('project_title.html'); loadFixtures('static/project_title.html.raw');
return this.project = new Project(); return this.project = new Project();
}); });
return describe('project list', function() { return describe('project list', function() {
...@@ -33,7 +32,7 @@ ...@@ -33,7 +32,7 @@
beforeEach((function(_this) { beforeEach((function(_this) {
return function() { 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)); return spyOn(jQuery, 'ajax').and.callFake(fakeAjaxResponse.bind(_this));
}; };
})(this)); })(this));
......
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
describe('RightSidebar', function() { describe('RightSidebar', function() {
var fixtureName = 'issues/open-issue.html.raw'; var fixtureName = 'issues/open-issue.html.raw';
fixture.preload(fixtureName); preloadFixtures(fixtureName);
beforeEach(function() { beforeEach(function() {
fixture.load(fixtureName); loadFixtures(fixtureName);
this.sidebar = new Sidebar; this.sidebar = new Sidebar;
$aside = $('.right-sidebar'); $aside = $('.right-sidebar');
$page = $('.page-with-sidebar'); $page = $('.page-with-sidebar');
...@@ -65,9 +65,10 @@ ...@@ -65,9 +65,10 @@
}); });
it('should broadcast todo:toggle event when add todo clicked', function() { it('should broadcast todo:toggle event when add todo clicked', function() {
var todos = getJSONFixture('todos.json');
spyOn(jQuery, 'ajax').and.callFake(function() { spyOn(jQuery, 'ajax').and.callFake(function() {
var d = $.Deferred(); var d = $.Deferred();
var response = fixture.load('todos.json'); var response = todos;
d.resolve(response); d.resolve(response);
return d.promise(); return d.promise();
}); });
......
...@@ -112,9 +112,9 @@ ...@@ -112,9 +112,9 @@
}; };
describe('Search autocomplete dropdown', function() { describe('Search autocomplete dropdown', function() {
fixture.preload('search_autocomplete.html'); preloadFixtures('static/search_autocomplete.html.raw');
beforeEach(function() { beforeEach(function() {
fixture.load('search_autocomplete.html'); loadFixtures('static/search_autocomplete.html.raw');
return widget = new gl.SearchAutocomplete; return widget = new gl.SearchAutocomplete;
}); });
it('should show Dashboard specific dropdown menu', function() { it('should show Dashboard specific dropdown menu', function() {
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
(function() { (function() {
describe('ShortcutsIssuable', function() { describe('ShortcutsIssuable', function() {
var fixtureName = 'issues/open-issue.html.raw'; var fixtureName = 'issues/open-issue.html.raw';
fixture.preload(fixtureName); preloadFixtures(fixtureName);
beforeEach(function() { beforeEach(function() {
fixture.load(fixtureName); loadFixtures(fixtureName);
document.querySelector('.js-new-note-form').classList.add('js-main-target-form'); document.querySelector('.js-new-note-form').classList.add('js-main-target-form');
return this.shortcut = new ShortcutsIssuable(); return this.shortcut = new ShortcutsIssuable();
}); });
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
((global) => { ((global) => {
describe('SigninTabsMemoizer', () => { describe('SigninTabsMemoizer', () => {
const fixtureTemplate = 'signin_tabs.html'; const fixtureTemplate = 'static/signin_tabs.html.raw';
const tabSelector = 'ul.nav-tabs'; const tabSelector = 'ul.nav-tabs';
const currentTabKey = 'current_signin_tab'; const currentTabKey = 'current_signin_tab';
let memo; let memo;
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
return memo; return memo;
} }
fixture.preload(fixtureTemplate); preloadFixtures(fixtureTemplate);
beforeEach(() => { beforeEach(() => {
fixture.load(fixtureTemplate); loadFixtures(fixtureTemplate);
}); });
it('does nothing if no tab was previously selected', () => { it('does nothing if no tab was previously selected', () => {
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
describe('DOM Events', function () { describe('DOM Events', function () {
beforeEach(function () { beforeEach(function () {
// This ensures DOM and DOM events are initialized for these specs. // This ensures DOM and DOM events are initialized for these specs.
fixture.set('<div></div>'); setFixtures('<div></div>');
this.smartInterval = createDefaultSmartInterval(); this.smartInterval = createDefaultSmartInterval();
}); });
......
...@@ -37,12 +37,12 @@ ...@@ -37,12 +37,12 @@
// file as a manifest. // file as a manifest.
// For more information: http://github.com/modeset/teaspoon // For more information: http://github.com/modeset/teaspoon
(function() { // set our fixtures path
jasmine.getFixtures().fixturesPath = '/teaspoon/fixtures';
jasmine.getJSONFixtures().fixturesPath = '/teaspoon/fixtures';
}).call(this);
// defined in ActionDispatch::TestRequest // defined in ActionDispatch::TestRequest
// see https://github.com/rails/rails/blob/v4.2.7.1/actionpack/lib/action_dispatch/testing/test_request.rb#L7 // see https://github.com/rails/rails/blob/v4.2.7.1/actionpack/lib/action_dispatch/testing/test_request.rb#L7
window.gl = window.gl || {}; window.gl = window.gl || {};
gl.TEST_HOST = 'http://test.host'; window.gl.TEST_HOST = 'http://test.host';
window.gon = window.gon || {};
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
}; };
describe('on a js-syntax-highlight element', function() { describe('on a js-syntax-highlight element', function() {
beforeEach(function() { beforeEach(function() {
return fixture.set('<div class="js-syntax-highlight"></div>'); return setFixtures('<div class="js-syntax-highlight"></div>');
}); });
return it('applies syntax highlighting', function() { return it('applies syntax highlighting', function() {
stubUserColorScheme('monokai'); stubUserColorScheme('monokai');
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
}); });
return describe('on a parent element', function() { return describe('on a parent element', function() {
beforeEach(function() { beforeEach(function() {
return fixture.set("<div class=\"parent\">\n <div class=\"js-syntax-highlight\"></div>\n <div class=\"foo\"></div>\n <div class=\"js-syntax-highlight\"></div>\n</div>"); return setFixtures("<div class=\"parent\">\n <div class=\"js-syntax-highlight\"></div>\n <div class=\"foo\"></div>\n <div class=\"js-syntax-highlight\"></div>\n</div>");
}); });
it('applies highlighting to all applicable children', function() { it('applies highlighting to all applicable children', function() {
stubUserColorScheme('monokai'); stubUserColorScheme('monokai');
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
}); });
return it('prevents an infinite loop when no matches exist', function() { return it('prevents an infinite loop when no matches exist', function() {
var highlight; var highlight;
fixture.set('<div></div>'); setFixtures('<div></div>');
highlight = function() { highlight = function() {
return $('div').syntaxHighlight(); return $('div').syntaxHighlight();
}; };
......
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
(function() { (function() {
describe('U2FAuthenticate', function() { describe('U2FAuthenticate', function() {
fixture.load('u2f/authenticate'); preloadFixtures('u2f/authenticate.html.raw');
beforeEach(function() { beforeEach(function() {
loadFixtures('u2f/authenticate.html.raw');
this.u2fDevice = new MockU2FDevice; this.u2fDevice = new MockU2FDevice;
this.container = $("#js-authenticate-u2f"); this.container = $("#js-authenticate-u2f");
this.component = new U2FAuthenticate(this.container, { this.component = new U2FAuthenticate(this.container, {
......
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
(function() { (function() {
describe('U2FRegister', function() { describe('U2FRegister', function() {
fixture.load('u2f/register'); preloadFixtures('u2f/register.html.raw');
beforeEach(function() { beforeEach(function() {
loadFixtures('u2f/register.html.raw');
this.u2fDevice = new MockU2FDevice; this.u2fDevice = new MockU2FDevice;
this.container = $("#js-register-u2f"); this.container = $("#js-register-u2f");
this.component = new U2FRegister(this.container, $("#js-register-u2f-templates"), {}, "token"); this.component = new U2FRegister(this.container, $("#js-register-u2f-templates"), {}, "token");
......
...@@ -5,7 +5,7 @@ describe('Commit component', () => { ...@@ -5,7 +5,7 @@ describe('Commit component', () => {
let component; let component;
it('should render a code-fork icon if it does not represent a tag', () => { it('should render a code-fork icon if it does not represent a tag', () => {
fixture.set('<div class="test-commit-container"></div>'); setFixtures('<div class="test-commit-container"></div>');
component = new window.gl.CommitComponent({ component = new window.gl.CommitComponent({
el: document.querySelector('.test-commit-container'), el: document.querySelector('.test-commit-container'),
propsData: { propsData: {
...@@ -30,7 +30,7 @@ describe('Commit component', () => { ...@@ -30,7 +30,7 @@ describe('Commit component', () => {
describe('Given all the props', () => { describe('Given all the props', () => {
beforeEach(() => { beforeEach(() => {
fixture.set('<div class="test-commit-container"></div>'); setFixtures('<div class="test-commit-container"></div>');
props = { props = {
tag: true, tag: true,
...@@ -105,7 +105,7 @@ describe('Commit component', () => { ...@@ -105,7 +105,7 @@ describe('Commit component', () => {
describe('When commit title is not provided', () => { describe('When commit title is not provided', () => {
it('should render default message', () => { it('should render default message', () => {
fixture.set('<div class="test-commit-container"></div>'); setFixtures('<div class="test-commit-container"></div>');
props = { props = {
tag: false, tag: false,
commitRef: { commitRef: {
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
describe('ZenMode', function() { describe('ZenMode', function() {
var fixtureName = 'issues/open-issue.html.raw'; var fixtureName = 'issues/open-issue.html.raw';
fixture.preload(fixtureName); preloadFixtures(fixtureName);
beforeEach(function() { beforeEach(function() {
fixture.load(fixtureName); loadFixtures(fixtureName);
spyOn(Dropzone, 'forElement').and.callFake(function() { spyOn(Dropzone, 'forElement').and.callFake(function() {
return { return {
enable: function() { enable: function() {
......
...@@ -20,12 +20,26 @@ module JavaScriptFixturesHelpers ...@@ -20,12 +20,26 @@ module JavaScriptFixturesHelpers
# Public: Store a response object as fixture file # 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) # fixture_file_name - file name to store the fixture in (relative to FIXTURE_PATH)
# #
def store_frontend_fixture(response, fixture_file_name) def store_frontend_fixture(response, fixture_file_name)
fixture_file_name = File.expand_path(fixture_file_name, FIXTURE_PATH) 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 fixture = response.body
fixture.force_encoding("utf-8")
response_mime_type = Mime::Type.lookup(response.content_type) response_mime_type = Mime::Type.lookup(response.content_type)
if response_mime_type.html? if response_mime_type.html?
...@@ -34,7 +48,7 @@ module JavaScriptFixturesHelpers ...@@ -34,7 +48,7 @@ module JavaScriptFixturesHelpers
link_tags = doc.css('link') link_tags = doc.css('link')
link_tags.remove link_tags.remove
scripts = doc.css('script') scripts = doc.css("script:not([type='text/template'])")
scripts.remove scripts.remove
fixture = doc.to_html fixture = doc.to_html
...@@ -44,7 +58,6 @@ module JavaScriptFixturesHelpers ...@@ -44,7 +58,6 @@ module JavaScriptFixturesHelpers
fixture.gsub!(%r{="/}, "=\"http://#{test_host}/") fixture.gsub!(%r{="/}, "=\"http://#{test_host}/")
end end
FileUtils.mkdir_p(File.dirname(fixture_file_name)) fixture
File.write(fixture_file_name, fixture)
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment