debian-mirror-gitlab/spec/frontend/fixtures/branches.rb

48 lines
1.3 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe 'Branches (JavaScript fixtures)' do
2017-08-17 22:00:37 +05:30
include JavaScriptFixturesHelpers
2020-07-28 23:09:34 +05:30
let_it_be(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
let_it_be(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') }
2021-02-22 17:27:13 +05:30
let_it_be(:user) { project.owner }
2017-08-17 22:00:37 +05:30
2020-07-28 23:09:34 +05:30
after(:all) do
remove_repository(project)
2017-08-17 22:00:37 +05:30
end
2020-07-28 23:09:34 +05:30
describe Projects::BranchesController, '(JavaScript fixtures)', type: :controller do
render_views
before do
2021-02-22 17:27:13 +05:30
sign_in(user)
2020-07-28 23:09:34 +05:30
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
2018-03-17 18:26:18 +05:30
end
2020-07-28 23:09:34 +05:30
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
2021-02-22 17:27:13 +05:30
get api("/projects/#{project.id}/repository/branches?search=ma", user)
2017-08-17 22:00:37 +05:30
2020-07-28 23:09:34 +05:30
expect(response).to be_successful
end
2017-08-17 22:00:37 +05:30
end
end