diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-10-19 09:32:07 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-10-19 09:32:07 +0000 |
commit | 8adeda37b55fc992e3cb15422cae5d9646640630 (patch) | |
tree | 527587a80e6b1dde56b4aca1f02f89998b97c8e3 /spec/controllers | |
parent | c9edffcba6443d2bf72cfa6dda15fd53c106657b (diff) | |
parent | 6ad78d3ab1fc0ea9f344810e22b4fa7e8d67b6f7 (diff) | |
download | gitlab-ce-8adeda37b55fc992e3cb15422cae5d9646640630.tar.gz |
Merge branch 'hanloong/gitlab-ce-remove-forks-from-projects-settings' into 'master'
Add ability to remove the fork relationship from project settings
![Screen_Shot_2015-10-18_at_12.37.24](/uploads/676571642a4c90f7f286280d714599a3/Screen_Shot_2015-10-18_at_12.37.24.png)
![Screen_Shot_2015-10-18_at_12.37.28](/uploads/1a069ecfc4cd3b5438772a9c3f04b6fc/Screen_Shot_2015-10-18_at_12.37.28.png)
Replaces !1579.
Fixes #2578.
See merge request !1636
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects_controller_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index b7ec5e48e85..4460bf12f96 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -90,4 +90,50 @@ describe ProjectsController do expect(user.starred?(public_project)).to be_falsey end end + + describe "DELETE remove_fork" do + context 'when signed in' do + before do + sign_in(user) + end + + context 'with forked project' do + let(:project_fork) { create(:project, namespace: user.namespace) } + + before do + create(:forked_project_link, forked_to_project: project_fork) + end + + it 'should remove fork from project' do + delete(:remove_fork, + namespace_id: project_fork.namespace.to_param, + id: project_fork.to_param, format: :js) + + expect(project_fork.forked?).to be_falsey + expect(flash[:notice]).to eq('The fork relationship has been removed.') + expect(response).to render_template(:remove_fork) + end + end + + context 'when project not forked' do + let(:unforked_project) { create(:project, namespace: user.namespace) } + + it 'should do nothing if project was not forked' do + delete(:remove_fork, + namespace_id: unforked_project.namespace.to_param, + id: unforked_project.to_param, format: :js) + + expect(flash[:notice]).to be_nil + expect(response).to render_template(:remove_fork) + end + end + end + + it "does nothing if user is not signed in" do + delete(:remove_fork, + namespace_id: project.namespace.to_param, + id: project.to_param, format: :js) + expect(response.status).to eq(401) + end + end end |