diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-01-08 22:19:52 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-01-08 22:19:52 +0300 |
commit | e2b759a2f483663e0771180de6b97bb9344a56cd (patch) | |
tree | 32cd72a70e405dc0858d774ca3354d6aef1bf445 /spec/controllers/projects/settings/ci_cd_controller_spec.rb | |
parent | 7ca5a3f99dd3a3c1800f65da7b4f08395a97395a (diff) | |
parent | df74461014bbdbc691f4f4039b02962dad292362 (diff) |
Merge branch 'master' into 34312-eslint-vue-plugin
* master: (140 commits)
Add Gitter room link to I want to contribute since you always have questions
Use workhorse 3.4.0
chore: remove symbolic link
Add memoization for properties
Resolve "Allow QA tests to run with `CHROME_HEADLESS=false`"
Resolve "Add graph value to hover"
Fix slash commands dropdown description
disables the shortcut to the issue boards when issues are disabled
Fix static analysys
Disable STI of ActiveRecord. Refactoring specs.
Fix StaticSnalysys
Fix change log
Add changelog
Revert bulk_insert and bring back AR insert(one by one)
Add a new test for emptified params
Use batch update for Service deactivation
Fix query to look for proper unmanaged kubernetes service
Fix static anylysy
Use bulk_insert instead of AR create
Opitmize migration process by using both unmanaged_kubernetes_service and kubernetes_service_without_template
...
Diffstat (limited to 'spec/controllers/projects/settings/ci_cd_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/settings/ci_cd_controller_spec.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/controllers/projects/settings/ci_cd_controller_spec.rb b/spec/controllers/projects/settings/ci_cd_controller_spec.rb index 77a47f0ad13..0202149f335 100644 --- a/spec/controllers/projects/settings/ci_cd_controller_spec.rb +++ b/spec/controllers/projects/settings/ci_cd_controller_spec.rb @@ -17,4 +17,51 @@ describe Projects::Settings::CiCdController do expect(response).to render_template(:show) end end + + describe '#reset_cache' do + before do + sign_in(user) + + project.add_master(user) + + allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(true) + end + + 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) + + subject + 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 + it 'sets the flash notice variable' do + subject + + expect(controller).to set_flash[:notice] + expect(controller).not_to set_flash[:error] + end + end + + context 'when service does not return successfully' do + before do + allow(ResetProjectCacheService).to receive_message_chain(:new, :execute).and_return(false) + end + + it 'sets the flash error variable' do + subject + + expect(controller).not_to set_flash[:notice] + expect(controller).to set_flash[:error] + end + end + end end |