Commit 7b3ea49a authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Fixed tests and a rubocop linter

parent 0af99433
...@@ -10,13 +10,11 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -10,13 +10,11 @@ class Projects::HooksController < Projects::ApplicationController
@hook = @project.hooks.new(hook_params) @hook = @project.hooks.new(hook_params)
@hook.save @hook.save
if @hook.valid? unless @hook.valid?
redirect_to namespace_project_settings_integrations_path(@project.namespace, @project)
else
@hooks = @project.hooks.select(&:persisted?) @hooks = @project.hooks.select(&:persisted?)
flash[:alert] = @hook.errors.full_messages.join.html_safe flash[:alert] = @hook.errors.full_messages.join.html_safe
redirect_to namespace_project_settings_integrations_path(@project.namespace, @project)
end end
redirect_to namespace_project_settings_integrations_path(@project.namespace, @project)
end end
def test def test
......
...@@ -262,8 +262,8 @@ describe "Internal Project Access", feature: true do ...@@ -262,8 +262,8 @@ describe "Internal Project Access", feature: true do
it { is_expected.to be_denied_for(:visitor) } it { is_expected.to be_denied_for(:visitor) }
end end
describe "GET /:project_path/hooks" do describe "GET /:project_path/settings/integrations" do
subject { namespace_project_hooks_path(project.namespace, project) } subject { namespace_project_settings_integrations_path(project.namespace, project) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
it { is_expected.to be_allowed_for(:owner).of(project) } it { is_expected.to be_allowed_for(:owner).of(project) }
......
...@@ -234,8 +234,8 @@ describe "Private Project Access", feature: true do ...@@ -234,8 +234,8 @@ describe "Private Project Access", feature: true do
it { is_expected.to be_denied_for(:visitor) } it { is_expected.to be_denied_for(:visitor) }
end end
describe "GET /:project_path/hooks" do describe "GET /:project_path/namespace/hooks" do
subject { namespace_project_hooks_path(project.namespace, project) } subject { namespace_project_settings_integrations_path(project.namespace, project) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
it { is_expected.to be_allowed_for(:owner).of(project) } it { is_expected.to be_allowed_for(:owner).of(project) }
......
...@@ -400,8 +400,8 @@ describe "Public Project Access", feature: true do ...@@ -400,8 +400,8 @@ describe "Public Project Access", feature: true do
it { is_expected.to be_allowed_for(:visitor) } it { is_expected.to be_allowed_for(:visitor) }
end end
describe "GET /:project_path/hooks" do describe "GET /:project_path/settings/integrations" do
subject { namespace_project_hooks_path(project.namespace, project) } subject { namespace_project_settings_integrations_path(project.namespace, project) }
it { is_expected.to be_allowed_for(:admin) } it { is_expected.to be_allowed_for(:admin) }
it { is_expected.to be_allowed_for(:owner).of(project) } it { is_expected.to be_allowed_for(:owner).of(project) }
......
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