debian-mirror-gitlab/spec/features/issues/resource_label_events_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

62 lines
1.7 KiB
Ruby
Raw Normal View History

2018-11-20 20:47:30 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2018-11-20 20:47:30 +05:30
2020-06-23 00:09:42 +05:30
RSpec.describe 'List issue resource label events', :js do
2018-11-20 20:47:30 +05:30
let(:user) { create(:user) }
let(:project) { create(:project, :public) }
let(:issue) { create(:issue, project: project, author: user) }
2019-03-02 22:35:43 +05:30
let!(:label) { create(:label, project: project, title: 'foo') }
2018-12-13 13:39:08 +05:30
let!(:user_status) { create(:user_status, user: user) }
2018-11-20 20:47:30 +05:30
context 'when user displays the issue' do
let!(:note) { create(:note_on_issue, author: user, project: project, noteable: issue, note: 'some note') }
let!(:event) { create(:resource_label_event, user: user, issue: issue, label: label) }
before do
visit project_issue_path(project, issue)
wait_for_requests
end
it 'shows both notes and resource label events' do
page.within('#notes') do
expect(find("#note_#{note.id}")).to have_content 'some note'
2022-11-25 23:54:43 +05:30
expect(find("#note_#{event.reload.discussion_id}")).to have_content 'added foo label'
2018-12-13 13:39:08 +05:30
end
end
2018-11-20 20:47:30 +05:30
end
context 'when user adds label to the issue' do
def toggle_labels(labels)
page.within '.labels' do
2020-11-24 15:15:51 +05:30
click_on 'Edit'
2018-11-20 20:47:30 +05:30
wait_for_requests
2021-11-11 11:23:49 +05:30
labels.each { |label| click_on label }
2018-11-20 20:47:30 +05:30
2021-06-08 01:23:25 +05:30
send_keys(:escape)
2018-11-20 20:47:30 +05:30
wait_for_requests
end
end
before do
create(:label, project: project, title: 'bar')
project.add_developer(user)
sign_in(user)
visit project_issue_path(project, issue)
wait_for_requests
end
it 'shows add note for newly added labels' do
toggle_labels(%w(foo bar))
visit project_issue_path(project, issue)
wait_for_requests
page.within('#notes') do
expect(page).to have_content 'added bar foo labels'
end
end
end
end