Commit 31b68539 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'clarify_branches_controller_spec_naming' into 'master'

Clarify branches controller spec developer/user definitions

See merge request gitlab-org/gitlab!34279
parents 2713ff7e bbe8a16f
......@@ -8,8 +8,7 @@ RSpec.describe Projects::BranchesController do
let(:developer) { create(:user) }
before do
project.add_maintainer(user)
project.add_developer(user)
project.add_developer(developer)
allow(project).to receive(:branches).and_return(['master', 'foo/bar/baz'])
allow(project).to receive(:tags).and_return(['v1.0.0', 'v2.0.0'])
......@@ -21,7 +20,7 @@ RSpec.describe Projects::BranchesController do
context "on creation of a new branch" do
before do
sign_in(user)
sign_in(developer)
post :create,
params: {
......@@ -80,7 +79,7 @@ RSpec.describe Projects::BranchesController do
let(:issue) { create(:issue, project: project) }
before do
sign_in(user)
sign_in(developer)
end
it 'redirects' do
......@@ -97,7 +96,7 @@ RSpec.describe Projects::BranchesController do
end
it 'posts a system note' do
expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch", branch_project: project)
expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, developer, "1-feature-branch", branch_project: project)
post :create,
params: {
......@@ -136,14 +135,14 @@ RSpec.describe Projects::BranchesController do
context 'user can update issue' do
before do
confidential_issue_project.add_reporter(user)
confidential_issue_project.add_reporter(developer)
end
context 'issue is under the specified project' do
let(:issue) { create(:issue, project: confidential_issue_project) }
it 'posts a system note' do
expect(SystemNoteService).to receive(:new_issue_branch).with(issue, confidential_issue_project, user, "1-feature-branch", branch_project: project)
expect(SystemNoteService).to receive(:new_issue_branch).with(issue, confidential_issue_project, developer, "1-feature-branch", branch_project: project)
create_branch_with_confidential_issue_project
end
......@@ -264,7 +263,7 @@ RSpec.describe Projects::BranchesController do
describe 'POST create with JSON format' do
before do
sign_in(user)
sign_in(developer)
end
context 'with valid params' do
......@@ -305,7 +304,7 @@ RSpec.describe Projects::BranchesController do
render_views
before do
sign_in(user)
sign_in(developer)
end
it 'returns 303' do
......@@ -325,7 +324,7 @@ RSpec.describe Projects::BranchesController do
render_views
before do
sign_in(user)
sign_in(developer)
post :destroy,
format: format,
......@@ -436,7 +435,7 @@ RSpec.describe Projects::BranchesController do
context 'when user is allowed to push' do
before do
sign_in(user)
sign_in(developer)
end
it 'redirects to branches' do
......@@ -454,7 +453,7 @@ RSpec.describe Projects::BranchesController do
context 'when user is not allowed to push' do
before do
sign_in(developer)
sign_in(user)
end
it 'responds with status 404' do
......@@ -469,7 +468,7 @@ RSpec.describe Projects::BranchesController do
render_views
before do
sign_in(user)
sign_in(developer)
end
context 'when rendering a JSON format' do
......@@ -564,7 +563,7 @@ RSpec.describe Projects::BranchesController do
describe 'GET diverging_commit_counts' do
before do
sign_in(user)
sign_in(developer)
end
it 'returns the commit counts behind and ahead of default branch' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment