Commit e4bb25f0 authored by Matija Čupić's avatar Matija Čupić

Update Projects::Settings::CiCdController#reset_cache specs

parent 7fc88fd7
...@@ -27,7 +27,7 @@ describe Projects::Settings::CiCdController do ...@@ -27,7 +27,7 @@ describe Projects::Settings::CiCdController do
allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(true) allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(true)
end end
subject { post :reset_cache, namespace_id: project.namespace, project_id: project } subject { post :reset_cache, namespace_id: project.namespace, project_id: project, format: :json }
it 'calls reset project cache service' do it 'calls reset project cache service' do
expect(ResetProjectCacheService).to receive_message_chain(:new, :execute) expect(ResetProjectCacheService).to receive_message_chain(:new, :execute)
...@@ -35,19 +35,11 @@ describe Projects::Settings::CiCdController do ...@@ -35,19 +35,11 @@ describe Projects::Settings::CiCdController do
subject subject
end end
it 'redirects to project pipelines path' do
subject
expect(response).to have_gitlab_http_status(:redirect)
expect(response).to redirect_to(project_pipelines_path(project))
end
context 'when service returns successfully' do context 'when service returns successfully' do
it 'sets the flash notice variable' do it 'returns a success header' do
subject subject
expect(controller).to set_flash[:notice] expect(response).to have_gitlab_http_status(:ok)
expect(controller).not_to set_flash[:error]
end end
end end
...@@ -56,11 +48,10 @@ describe Projects::Settings::CiCdController do ...@@ -56,11 +48,10 @@ describe Projects::Settings::CiCdController do
allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(false) allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(false)
end end
it 'sets the flash error variable' do it 'returns an error header' do
subject subject
expect(controller).not_to set_flash[:notice] expect(response).to have_gitlab_http_status(:bad_request)
expect(controller).to set_flash[:error]
end end
end end
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