Fixed tests and a rubocop linter

This commit is contained in:
Jose Ivan Vargas 2017-01-18 15:40:16 -06:00
parent 0af9943314
commit 7b3ea49a44
4 changed files with 8 additions and 10 deletions

View file

@ -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

View file

@ -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) }

View file

@ -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) }

View file

@ -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) }