summaryrefslogtreecommitdiff
path: root/spec/features/admin/admin_labels_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/admin/admin_labels_spec.rb')
-rw-r--r--spec/features/admin/admin_labels_spec.rb24
1 files changed, 20 insertions, 4 deletions
diff --git a/spec/features/admin/admin_labels_spec.rb b/spec/features/admin/admin_labels_spec.rb
index 86d60b5d483..ba0870a53ae 100644
--- a/spec/features/admin/admin_labels_spec.rb
+++ b/spec/features/admin/admin_labels_spec.rb
@@ -3,6 +3,8 @@
require 'spec_helper'
RSpec.describe 'admin issues labels' do
+ include Spec::Support::Helpers::ModalHelpers
+
let!(:bug_label) { Label.create!(title: 'bug', template: true) }
let!(:feature_label) { Label.create!(title: 'feature', template: true) }
@@ -59,7 +61,7 @@ RSpec.describe 'admin issues labels' do
it 'creates new label' do
fill_in 'Title', with: 'support'
fill_in 'Background color', with: '#F95610'
- click_button 'Save'
+ click_button 'Create label'
page.within '.manage-labels-list' do
expect(page).to have_content('support')
@@ -69,7 +71,7 @@ RSpec.describe 'admin issues labels' do
it 'does not creates label with invalid color' do
fill_in 'Title', with: 'support'
fill_in 'Background color', with: '#12'
- click_button 'Save'
+ click_button 'Create label'
page.within '.label-form' do
expect(page).to have_content('Color must be a valid color code')
@@ -79,7 +81,7 @@ RSpec.describe 'admin issues labels' do
it 'does not creates label if label already exists' do
fill_in 'Title', with: 'bug'
fill_in 'Background color', with: '#F95610'
- click_button 'Save'
+ click_button 'Create label'
page.within '.label-form' do
expect(page).to have_content 'Title has already been taken'
@@ -93,11 +95,25 @@ RSpec.describe 'admin issues labels' do
fill_in 'Title', with: 'fix'
fill_in 'Background color', with: '#F15610'
- click_button 'Save'
+ click_button 'Save changes'
page.within '.manage-labels-list' do
expect(page).to have_content('fix')
end
end
+
+ it 'allows user to delete label', :js do
+ visit edit_admin_label_path(bug_label)
+
+ click_button 'Delete'
+
+ within_modal do
+ expect(page).to have_content("#{bug_label.title} will be permanently deleted. This cannot be undone.")
+
+ click_link 'Delete label'
+ end
+
+ expect(page).to have_content('Label was removed')
+ end
end
end