summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-08-14 11:01:43 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-08-14 11:01:43 +0000
commit3483024d93b9ca56e0bddffbbd0aff5714eb2833 (patch)
tree63c5830ace78f20e3edb7da70be9656e35ad7c5e /spec
parentb6bdd650a54306c3f56f8332a64a3f5194ee793d (diff)
parentf33fe50f0d37757bd482106fe4e82c09ecfe42d0 (diff)
downloadgitlab-ce-3483024d93b9ca56e0bddffbbd0aff5714eb2833.tar.gz
Merge branch 'disable-internal-tracker-when-external-in-use' into 'master'
Disable internal issue tracker if external tracker in use ### What does this MR do? This MR disables routes to the internal issue tracker if an external issue tracker (e.g. Redmine) is in use. A 404 page is returned if a user attempts to access any of the issue routes. ### Why was this MR needed? Enabling the external issue tracker would still keep the internal one active, which would lead to odd behavior where users could create issues but not close them. ### What are the relevant issue numbers? Closes #2006 See merge request !993
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb
new file mode 100644
index 00000000000..871b9219ca9
--- /dev/null
+++ b/spec/controllers/projects/issues_controller_spec.rb
@@ -0,0 +1,37 @@
+require('spec_helper')
+
+describe Projects::IssuesController do
+ let(:project) { create(:project) }
+ let(:user) { create(:user) }
+ let(:issue) { create(:issue, project: project) }
+
+ before do
+ sign_in(user)
+ project.team << [user, :developer]
+ controller.instance_variable_set(:@project, project)
+ end
+
+ describe "GET #index" do
+ it "returns index" do
+ get :index, namespace_id: project.namespace.id, project_id: project.id
+
+ expect(response.status).to eq(200)
+ end
+
+ it "returns 404 when issues are disabled" do
+ project.issues_enabled = false
+ project.save
+
+ get :index, namespace_id: project.namespace.id, project_id: project.id
+ expect(response.status).to eq(404)
+ end
+
+ it "returns 404 when external issue tracker is enabled" do
+ allow(project).to receive(:default_issues_tracker?).and_return(false)
+
+ get :index, namespace_id: project.namespace.id, project_id: project.id
+ expect(response.status).to eq(404)
+ end
+
+ end
+end