2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Edit group label' do
|
2022-03-02 08:16:31 +05:30
|
|
|
include Spec::Support::Helpers::ModalHelpers
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:group) { create(:group) }
|
|
|
|
let(:label) { create(:group_label, group: group) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
before do
|
2017-08-17 22:00:37 +05:30
|
|
|
group.add_owner(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2017-08-17 22:00:37 +05:30
|
|
|
visit edit_group_label_path(group, label)
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'update label with new title' do
|
2017-08-17 22:00:37 +05:30
|
|
|
fill_in 'label_title', with: 'new label name'
|
|
|
|
click_button 'Save changes'
|
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
expect(page).to have_current_path(root_path, ignore_query: true)
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(label.reload.title).to eq('new label name')
|
|
|
|
end
|
2022-03-02 08:16:31 +05:30
|
|
|
|
|
|
|
it 'allows user to delete label', :js do
|
|
|
|
click_button 'Delete'
|
|
|
|
|
|
|
|
within_modal do
|
|
|
|
expect(page).to have_content("#{label.title} will be permanently deleted from #{group.name}. This cannot be undone.")
|
|
|
|
|
|
|
|
click_link 'Delete label'
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(page).to have_content("#{label.title} deleted permanently")
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|