summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-02-17 12:46:21 -0600
committerDouwe Maan <douwe@selenight.nl>2017-02-17 12:54:41 -0600
commit4a8a28eb9e9dffb03a8c8be413aa341f452ce113 (patch)
tree174055c93969dfe6229d2df4efa2ca70fb868087 /spec/controllers
parenta2801ec429a0ac02e622d61119439ff71150acf2 (diff)
downloadgitlab-ce-4a8a28eb9e9dffb03a8c8be413aa341f452ce113.tar.gz
Fix issue where files on a fork could not be edited
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/blob_controller_spec.rb51
1 files changed, 32 insertions, 19 deletions
diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb
index b36d0e69330..f72a958662e 100644
--- a/spec/controllers/projects/blob_controller_spec.rb
+++ b/spec/controllers/projects/blob_controller_spec.rb
@@ -92,26 +92,39 @@ describe Projects::BlobController do
before { sign_in(guest) }
- it "redirects to forked project new merge request" do
- default_params[:target_branch] = "fork-test-1"
- default_params[:create_merge_request] = 1
-
- allow_any_instance_of(Files::UpdateService).to receive(:commit).and_return(:success)
-
- put :update, default_params
-
- expect(response).to redirect_to(
- new_namespace_project_merge_request_path(
- forked_project.namespace,
- forked_project,
- merge_request: {
- source_project_id: forked_project.id,
- target_project_id: project.id,
- source_branch: "fork-test-1",
- target_branch: "master"
- }
+ context 'when editing on the fork' do
+ before do
+ default_params[:namespace_id] = forked_project.namespace.to_param
+ default_params[:project_id] = forked_project.to_param
+ end
+
+ it 'redirects to blob' do
+ put :update, default_params
+
+ expect(response).to redirect_to(namespace_project_blob_path(forked_project.namespace, forked_project, 'master/CHANGELOG'))
+ end
+ end
+
+ context 'when editing on the original repository' do
+ it "redirects to forked project new merge request" do
+ default_params[:target_branch] = "fork-test-1"
+ default_params[:create_merge_request] = 1
+
+ put :update, default_params
+
+ expect(response).to redirect_to(
+ new_namespace_project_merge_request_path(
+ forked_project.namespace,
+ forked_project,
+ merge_request: {
+ source_project_id: forked_project.id,
+ target_project_id: project.id,
+ source_branch: "fork-test-1",
+ target_branch: "master"
+ }
+ )
)
- )
+ end
end
end
end