Commit 1852dfa3 authored by Filipa Lacerda's avatar Filipa Lacerda

Adds type for shared note specs

parent 1e41440b
......@@ -18,7 +18,7 @@ describe 'Reportable note on commit', :js do
visit project_commit_path(project, sample_commit.id)
end
it_behaves_like 'reportable note'
it_behaves_like 'reportable note', 'commit'
end
context 'a diff note' do
......@@ -28,6 +28,6 @@ describe 'Reportable note on commit', :js do
visit project_commit_path(project, sample_commit.id)
end
it_behaves_like 'reportable note'
it_behaves_like 'reportable note', 'commit'
end
end
......@@ -13,5 +13,5 @@ describe 'Reportable note on issue', :js do
visit project_issue_path(project, issue)
end
it_behaves_like 'reportable note'
it_behaves_like 'reportable note', 'issue'
end
......@@ -15,12 +15,12 @@ describe 'Reportable note on merge request', :js do
context 'a normal note' do
let!(:note) { create(:note_on_merge_request, noteable: merge_request, project: project) }
it_behaves_like 'reportable note'
it_behaves_like 'reportable note', 'merge_request'
end
context 'a diff note' do
let!(:note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project) }
it_behaves_like 'reportable note'
it_behaves_like 'reportable note', 'merge_request'
end
end
......@@ -17,6 +17,6 @@ describe 'Reportable note on snippets', :js do
visit project_snippet_path(project, snippet)
end
it_behaves_like 'reportable note'
it_behaves_like 'reportable note', 'snippets'
end
end
require 'spec_helper'
shared_examples 'reportable note' do
shared_examples 'reportable note' do |type|
include NotesHelper
let(:comment) { find("##{ActionView::RecordIdentifier.dom_id(note)}") }
......@@ -15,8 +15,14 @@ shared_examples 'reportable note' do
dropdown = comment.find(more_actions_selector)
open_dropdown(dropdown)
if type == 'issue'
expect(dropdown).to have_button('Edit comment')
expect(dropdown).to have_button('Delete comment')
else
expect(dropdown).to have_link('Edit comment')
expect(dropdown).to have_link('Delete comment')
end
expect(dropdown).to have_link('Report as abuse', href: abuse_report_path)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment