diff options
Diffstat (limited to 'spec/support/shared_examples')
-rw-r--r-- | spec/support/shared_examples/requests/api/discussions.rb | 23 | ||||
-rw-r--r-- | spec/support/shared_examples/wiki_file_attachments_examples.rb | 8 |
2 files changed, 27 insertions, 4 deletions
diff --git a/spec/support/shared_examples/requests/api/discussions.rb b/spec/support/shared_examples/requests/api/discussions.rb index a36bc2dc9b5..2a5a48f3054 100644 --- a/spec/support/shared_examples/requests/api/discussions.rb +++ b/spec/support/shared_examples/requests/api/discussions.rb @@ -117,6 +117,29 @@ shared_examples 'discussions API' do |parent_type, noteable_type, id_name, can_r expect(response).to have_gitlab_http_status(401) end + it 'tracks a Notes::CreateService event' do + expect(Gitlab::Tracking).to receive(:event) do |category, action, data| + expect(category).to eq('Notes::CreateService') + expect(action).to eq('execute') + expect(data[:label]).to eq('note') + expect(data[:value]).to be_an(Integer) + end + + post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/discussions", user), params: { body: 'hi!' } + end + + context 'with notes_create_service_tracking feature flag disabled' do + before do + stub_feature_flags(notes_create_service_tracking: false) + end + + it 'does not track any events' do + expect(Gitlab::Tracking).not_to receive(:event) + + post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/discussions"), params: { body: 'hi!' } + end + end + context 'when an admin or owner makes the request' do it 'accepts the creation date to be set' do creation_time = 2.weeks.ago diff --git a/spec/support/shared_examples/wiki_file_attachments_examples.rb b/spec/support/shared_examples/wiki_file_attachments_examples.rb index a43b7c0300f..22fbfb48928 100644 --- a/spec/support/shared_examples/wiki_file_attachments_examples.rb +++ b/spec/support/shared_examples/wiki_file_attachments_examples.rb @@ -42,7 +42,7 @@ shared_examples 'wiki file attachments' do end end - context 'uploading is complete' do + context 'uploading is complete', :quarantine do it 'shows "Attach a file" button on uploading complete' do attach_with_dropzone wait_for_requests @@ -52,11 +52,11 @@ shared_examples 'wiki file attachments' do end it 'the markdown link is added to the page' do - fill_in(:wiki_page_content, with: '') + fill_in(:wiki_content, with: '') attach_with_dropzone(true) wait_for_requests - expect(page.find('#wiki_page_content').value) + expect(page.find('#wiki_content').value) .to match(%r{\!\[dk\]\(uploads/\h{32}/dk\.png\)$}) end @@ -70,7 +70,7 @@ shared_examples 'wiki file attachments' do img_link = page.find('a.no-attachment-icon img')['src'] expect(link).to eq img_link - expect(URI.parse(link).path).to eq File.join(wiki.wiki_page_path, file_path) + expect(URI.parse(link).path).to eq File.join(wiki.wiki_base_path, file_path) end it 'the file has been added to the wiki repository' do |