2019-10-17 02:07:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-09 16:39:04 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-06 14:09:13 -04:00
|
|
|
RSpec.describe 'Branches (JavaScript fixtures)' do
|
2017-02-09 16:39:04 -05:00
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
2020-07-06 14:09:13 -04:00
|
|
|
let_it_be(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
|
|
|
|
let_it_be(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') }
|
2022-01-21 16:16:35 -05:00
|
|
|
let_it_be(:user) { project.first_owner }
|
2017-02-09 16:39:04 -05:00
|
|
|
|
2020-07-06 14:09:13 -04:00
|
|
|
after(:all) do
|
|
|
|
remove_repository(project)
|
2017-02-09 16:39:04 -05:00
|
|
|
end
|
|
|
|
|
2020-07-06 14:09:13 -04:00
|
|
|
describe Projects::BranchesController, '(JavaScript fixtures)', type: :controller do
|
|
|
|
render_views
|
|
|
|
|
|
|
|
before do
|
2020-12-07 07:10:00 -05:00
|
|
|
sign_in(user)
|
2020-07-06 14:09:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'branches/new_branch.html' do
|
|
|
|
get :new, params: {
|
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
project_id: project
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
2017-08-22 19:19:35 -04:00
|
|
|
end
|
|
|
|
|
2020-07-06 14:09:13 -04:00
|
|
|
describe API::Branches, '(JavaScript fixtures)', type: :request do
|
|
|
|
include ApiHelpers
|
|
|
|
|
|
|
|
it 'api/branches/branches.json' do
|
|
|
|
# The search query "ma" matches a few branch names in the test
|
|
|
|
# repository with a variety of different properties, including:
|
|
|
|
# - "master": default, protected
|
|
|
|
# - "markdown": non-default, protected
|
|
|
|
# - "many_files": non-default, not protected
|
2020-12-07 07:10:00 -05:00
|
|
|
get api("/projects/#{project.id}/repository/branches?search=ma", user)
|
2017-02-09 16:39:04 -05:00
|
|
|
|
2020-07-06 14:09:13 -04:00
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
2017-02-09 16:39:04 -05:00
|
|
|
end
|
|
|
|
end
|