summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2017-02-13 19:21:06 +0000
committerAlfredo Sumaran <alfredo@gitlab.com>2017-02-13 19:21:06 +0000
commit828776ed93710ac130bfc5e89f0c948c2e5dd8b5 (patch)
treefd4f507b78f22fc15742d559bffa7f919812e4b4
parent99df355ec2d6a934620254423f2a9451b88c6ab4 (diff)
parentfc7d2a88f4256a68eb884981fcc2dd99febaa668 (diff)
downloadgitlab-ce-828776ed93710ac130bfc5e89f0c948c2e5dd8b5.tar.gz
Merge branch 'merge-request-tabs-fixture' into 'master'
Replace static fixture for merge_request_tabs_spec.js See merge request !9172
-rw-r--r--changelogs/unreleased/merge-request-tabs-fixture.yml4
-rw-r--r--spec/javascripts/fixtures/merge_request_tabs.html.haml22
-rw-r--r--spec/javascripts/fixtures/merge_requests.rb36
-rw-r--r--spec/javascripts/merge_request_tabs_spec.js4
4 files changed, 42 insertions, 24 deletions
diff --git a/changelogs/unreleased/merge-request-tabs-fixture.yml b/changelogs/unreleased/merge-request-tabs-fixture.yml
new file mode 100644
index 00000000000..289cd7b604a
--- /dev/null
+++ b/changelogs/unreleased/merge-request-tabs-fixture.yml
@@ -0,0 +1,4 @@
+---
+title: Replace static fixture for merge_request_tabs_spec.js
+merge_request: 9172
+author: winniehell
diff --git a/spec/javascripts/fixtures/merge_request_tabs.html.haml b/spec/javascripts/fixtures/merge_request_tabs.html.haml
deleted file mode 100644
index 68678c3d7e3..00000000000
--- a/spec/javascripts/fixtures/merge_request_tabs.html.haml
+++ /dev/null
@@ -1,22 +0,0 @@
-%ul.nav.nav-tabs.merge-request-tabs
- %li.notes-tab
- %a{href: '/foo/bar/merge_requests/1', data: {target: 'div#notes', action: 'notes', toggle: 'tab'}}
- Discussion
- %li.commits-tab
- %a{href: '/foo/bar/merge_requests/1/commits', data: {target: 'div#commits', action: 'commits', toggle: 'tab'}}
- Commits
- %li.diffs-tab
- %a{href: '/foo/bar/merge_requests/1/diffs', data: {target: 'div#diffs', action: 'diffs', toggle: 'tab'}}
- Diffs
-
-.tab-content
- #notes.notes.tab-pane
- Notes Content
- #commits.commits.tab-pane
- Commits Content
- #diffs.diffs.tab-pane
- Diffs Content
-
-.mr-loading-status
- .loading
- Loading Animation
diff --git a/spec/javascripts/fixtures/merge_requests.rb b/spec/javascripts/fixtures/merge_requests.rb
new file mode 100644
index 00000000000..62984097099
--- /dev/null
+++ b/spec/javascripts/fixtures/merge_requests.rb
@@ -0,0 +1,36 @@
+require 'spec_helper'
+
+describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :controller do
+ include JavaScriptFixturesHelpers
+
+ let(:admin) { create(:admin) }
+ let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
+ let(:project) { create(:project, namespace: namespace, path: 'merge-requests-project') }
+
+ render_views
+
+ before(:all) do
+ clean_frontend_fixtures('merge_requests/')
+ end
+
+ before(:each) do
+ sign_in(admin)
+ end
+
+ it 'merge_requests/merge_request_with_task_list.html.raw' do |example|
+ merge_request = create(:merge_request, :with_diffs, source_project: project, target_project: project, description: '- [ ] Task List Item')
+ render_merge_request(example.description, merge_request)
+ end
+
+ private
+
+ def render_merge_request(fixture_file_name, merge_request)
+ get :show,
+ namespace_id: project.namespace.to_param,
+ project_id: project.to_param,
+ id: merge_request.to_param
+
+ expect(response).to be_success
+ store_frontend_fixture(response, fixture_file_name)
+ end
+end
diff --git a/spec/javascripts/merge_request_tabs_spec.js b/spec/javascripts/merge_request_tabs_spec.js
index 92a0f1c05f7..3810991f104 100644
--- a/spec/javascripts/merge_request_tabs_spec.js
+++ b/spec/javascripts/merge_request_tabs_spec.js
@@ -25,7 +25,7 @@ require('vendor/jquery.scrollTo');
};
$.extend(stubLocation, defaults, stubs || {});
};
- preloadFixtures('static/merge_request_tabs.html.raw');
+ preloadFixtures('merge_requests/merge_request_with_task_list.html.raw');
beforeEach(function () {
this.class = new gl.MergeRequestTabs({ stubLocation: stubLocation });
@@ -41,7 +41,7 @@ require('vendor/jquery.scrollTo');
describe('#activateTab', function () {
beforeEach(function () {
spyOn($, 'ajax').and.callFake(function () {});
- loadFixtures('static/merge_request_tabs.html.raw');
+ loadFixtures('merge_requests/merge_request_with_task_list.html.raw');
this.subject = this.class.activateTab;
});
it('shows the first tab when action is show', function () {