Merge branch 'new-branch-fixture' into 'master'

Replace static fixture for new_branch_spec.js

See merge request !9131
This commit is contained in:
Clement Ho 2017-02-13 15:06:10 +00:00
commit b94cf7e669
4 changed files with 34 additions and 6 deletions

View File

@ -0,0 +1,4 @@
---
title: Replace static fixture for new_branch_spec.js
merge_request: 9131
author: winniehell

View File

@ -0,0 +1,28 @@
require 'spec_helper'
describe Projects::BranchesController, '(JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers
let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') }
render_views
before(:all) do
clean_frontend_fixtures('branches/')
end
before(:each) do
sign_in(admin)
end
it 'branches/new_branch.html.raw' do |example|
get :new,
namespace_id: project.namespace.to_param,
project_id: project.to_param
expect(response).to be_success
store_frontend_fixture(response, example.description)
end
end

View File

@ -1,4 +0,0 @@
%form.js-create-branch-form
%input.js-branch-name
.js-branch-name-error
%input{id: "ref"}

View File

@ -8,7 +8,7 @@ require('~/new_branch_form');
describe('Branch', function() {
return describe('create a new branch', function() {
var expectToHaveError, fillNameWith;
preloadFixtures('static/new_branch.html.raw');
preloadFixtures('branches/new_branch.html.raw');
fillNameWith = function(value) {
return $('.js-branch-name').val(value).trigger('blur');
};
@ -16,7 +16,7 @@ require('~/new_branch_form');
return expect($('.js-branch-name-error span').text()).toEqual(error);
};
beforeEach(function() {
loadFixtures('static/new_branch.html.raw');
loadFixtures('branches/new_branch.html.raw');
$('form').on('submit', function(e) {
return e.preventDefault();
});