Commit 8516e3ab authored by Micaël Bergeron's avatar Micaël Bergeron

add spec for forked project

parent 4714cb58
require 'spec_helper' require 'spec_helper'
describe Projects::MergeRequestsController do shared_examples 'approvals' do
let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:user) { project.owner }
let(:viewer) { user }
before do
sign_in(viewer)
end
context 'approvals' do
def json_response def json_response
JSON.parse(response.body) JSON.parse(response.body)
end end
...@@ -85,8 +75,20 @@ describe Projects::MergeRequestsController do ...@@ -85,8 +75,20 @@ describe Projects::MergeRequestsController do
expect(json_response['suggested_approvers'].size).to eq 2 expect(json_response['suggested_approvers'].size).to eq 2
end end
end end
end
describe Projects::MergeRequestsController do
let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request_with_diffs, target_project: project, source_project: project) }
let(:user) { project.owner }
let(:viewer) { user }
before do
sign_in(viewer)
end end
it_behaves_like 'approvals'
describe 'PUT update' do describe 'PUT update' do
def update_merge_request(params = {}) def update_merge_request(params = {})
post :update, post :update,
...@@ -353,6 +355,8 @@ describe Projects::MergeRequestsController do ...@@ -353,6 +355,8 @@ describe Projects::MergeRequestsController do
fork_project.add_reporter(user) fork_project.add_reporter(user)
end end
it_behaves_like 'approvals'
context 'user cannot push to source branch' do context 'user cannot push to source branch' do
it 'returns 404' do it 'returns 404' do
expect_rebase_worker_for(viewer).never expect_rebase_worker_for(viewer).never
......
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