Commit 6bff207d authored by Francesco Levorato's avatar Francesco Levorato

Refactor spec to go through ApplicationController#project

parent 69cb5fba
...@@ -8,12 +8,11 @@ describe Projects::IssuesController do ...@@ -8,12 +8,11 @@ describe Projects::IssuesController do
before do before do
sign_in(user) sign_in(user)
project.team << [user, :developer] project.team << [user, :developer]
controller.instance_variable_set(:@project, project)
end end
describe "GET #index" do describe "GET #index" do
it "returns index" do it "returns index" do
get :index, namespace_id: project.namespace.id, project_id: project.id get :index, namespace_id: project.namespace.path, project_id: project.path
expect(response.status).to eq(200) expect(response.status).to eq(200)
end end
...@@ -22,14 +21,15 @@ describe Projects::IssuesController do ...@@ -22,14 +21,15 @@ describe Projects::IssuesController do
project.issues_enabled = false project.issues_enabled = false
project.save project.save
get :index, namespace_id: project.namespace.id, project_id: project.id get :index, namespace_id: project.namespace.path, project_id: project.path
expect(response.status).to eq(404) expect(response.status).to eq(404)
end end
it "returns 404 when external issue tracker is enabled" do it "returns 404 when external issue tracker is enabled" do
controller.instance_variable_set(:@project, project)
allow(project).to receive(:default_issues_tracker?).and_return(false) allow(project).to receive(:default_issues_tracker?).and_return(false)
get :index, namespace_id: project.namespace.id, project_id: project.id get :index, namespace_id: project.namespace.path, project_id: project.path
expect(response.status).to eq(404) expect(response.status).to eq(404)
end end
......
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