summaryrefslogtreecommitdiff
path: root/spec/frontend/fixtures/branches.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/fixtures/branches.rb')
-rw-r--r--spec/frontend/fixtures/branches.rb50
1 files changed, 34 insertions, 16 deletions
diff --git a/spec/frontend/fixtures/branches.rb b/spec/frontend/fixtures/branches.rb
index 4667dfb69f8..df2d1af7ecf 100644
--- a/spec/frontend/fixtures/branches.rb
+++ b/spec/frontend/fixtures/branches.rb
@@ -2,33 +2,51 @@
require 'spec_helper'
-RSpec.describe Projects::BranchesController, '(JavaScript fixtures)', type: :controller do
+RSpec.describe 'Branches (JavaScript fixtures)' 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
+ let_it_be(:admin) { create(:admin) }
+ let_it_be(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
+ let_it_be(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') }
before(:all) do
clean_frontend_fixtures('branches/')
+ clean_frontend_fixtures('api/branches/')
end
- before do
- sign_in(admin)
+ after(:all) do
+ remove_repository(project)
end
- after do
- remove_repository(project)
+ describe Projects::BranchesController, '(JavaScript fixtures)', type: :controller do
+ render_views
+
+ before do
+ sign_in(admin)
+ 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
end
- it 'branches/new_branch.html' do
- get :new, params: {
- namespace_id: project.namespace.to_param,
- project_id: project
- }
+ 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
+ get api("/projects/#{project.id}/repository/branches?search=ma", admin)
- expect(response).to be_successful
+ expect(response).to be_successful
+ end
end
end