diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2017-06-29 14:43:01 +0300 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2017-07-20 11:59:56 +0300 |
commit | 3491b19a4e67a9f439c12afac45ef38f3fce0ef5 (patch) | |
tree | a548a111e88c046315e0a2633aba5656be7603ba /spec/features/projects | |
parent | f0e4e3993b1f5a21ab61aaff95f73ac4e5b88ad3 (diff) |
Add specs for ProjectDestroyWorker
Diffstat (limited to 'spec/features/projects')
-rw-r--r-- | spec/features/projects/show_project_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/features/projects/show_project_spec.rb b/spec/features/projects/show_project_spec.rb new file mode 100644 index 00000000000..5aa0d8f0026 --- /dev/null +++ b/spec/features/projects/show_project_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe 'Project show page', feature: true do + context 'when project pending delete' do + let(:project) { create(:project, :empty_repo, pending_delete: true) } + let(:worker) { ProjectDestroyWorker.new } + + before do + sign_in(project.owner) + end + + it 'shows flash error if deletion for project fails' do + error_message = "some error message" + project.update_attributes(delete_error: error_message, pending_delete: false) + + visit namespace_project_path(project.namespace, project) + + expect(page).to have_selector('.project-deletion-failed-message') + expect(page).to have_content("This project was scheduled for deletion, but failed with the following message: #{error_message}") + end + + it 'renders 404 if project was successfully deleted' do + worker.perform(project.id, project.owner.id, {}) + + visit namespace_project_path(project.namespace, project) + + expect(page).to have_http_status(404) + end + end +end |