Change reset_cache action from get to post

This commit is contained in:
Matija Čupić 2018-01-05 19:22:07 +01:00
parent d66c48b303
commit 21a713f9c4
No known key found for this signature in database
GPG Key ID: 4BAF84FFACD2E5DE
4 changed files with 6 additions and 7 deletions

View File

@ -50,10 +50,9 @@ export default {
Get started with Pipelines
</a>
<a :href="resetCachePath"
class="btn btn-default">
Clear runner caches
</a>
<form :action="resetCachePath" method="post">
<input type="submit" class="btn btn-default" value="Clear runner caches" />
</form>
<a
:href="ciLintPath"

View File

@ -409,7 +409,7 @@ constraints(ProjectUrlConstrainer.new) do
namespace :settings do
get :members, to: redirect("%{namespace_id}/%{project_id}/project_members")
resource :ci_cd, only: [:show], controller: 'ci_cd' do
get :reset_cache
post :reset_cache
end
resource :integrations, only: [:show]
resource :repository, only: [:show], controller: :repository

View File

@ -27,7 +27,7 @@ describe Projects::Settings::CiCdController do
allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(true)
end
subject { get :reset_cache, namespace_id: project.namespace, project_id: project }
subject { post :reset_cache, namespace_id: project.namespace, project_id: project }
it 'calls reset project cache service' do
expect(ResetProjectCacheService).to receive_message_chain(:new, :execute)

View File

@ -58,7 +58,7 @@ describe('Pipelines Nav Controls', () => {
}).$mount();
expect(component.$el.querySelectorAll('.btn-default')[0].textContent).toContain('Clear runner caches');
expect(component.$el.querySelectorAll('.btn-default')[0].getAttribute('href')).toEqual(mockData.resetCachePath);
expect(component.$el.querySelector('form').getAttribute('action')).toEqual(mockData.resetCachePath);
});
it('should render link for CI lint', () => {