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 ...@@ -18,7 +18,7 @@ describe 'Reportable note on commit', :js do
visit project_commit_path(project, sample_commit.id) visit project_commit_path(project, sample_commit.id)
end end
it_behaves_like 'reportable note' it_behaves_like 'reportable note', 'commit'
end end
context 'a diff note' do context 'a diff note' do
...@@ -28,6 +28,6 @@ describe 'Reportable note on commit', :js do ...@@ -28,6 +28,6 @@ describe 'Reportable note on commit', :js do
visit project_commit_path(project, sample_commit.id) visit project_commit_path(project, sample_commit.id)
end end
it_behaves_like 'reportable note' it_behaves_like 'reportable note', 'commit'
end end
end end
...@@ -13,5 +13,5 @@ describe 'Reportable note on issue', :js do ...@@ -13,5 +13,5 @@ describe 'Reportable note on issue', :js do
visit project_issue_path(project, issue) visit project_issue_path(project, issue)
end end
it_behaves_like 'reportable note' it_behaves_like 'reportable note', 'issue'
end end
...@@ -15,12 +15,12 @@ describe 'Reportable note on merge request', :js do ...@@ -15,12 +15,12 @@ describe 'Reportable note on merge request', :js do
context 'a normal note' do context 'a normal note' do
let!(:note) { create(:note_on_merge_request, noteable: merge_request, project: project) } 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 end
context 'a diff note' do context 'a diff note' do
let!(:note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project) } 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
end end
...@@ -17,6 +17,6 @@ describe 'Reportable note on snippets', :js do ...@@ -17,6 +17,6 @@ describe 'Reportable note on snippets', :js do
visit project_snippet_path(project, snippet) visit project_snippet_path(project, snippet)
end end
it_behaves_like 'reportable note' it_behaves_like 'reportable note', 'snippets'
end end
end end
require 'spec_helper' require 'spec_helper'
shared_examples 'reportable note' do shared_examples 'reportable note' do |type|
include NotesHelper include NotesHelper
let(:comment) { find("##{ActionView::RecordIdentifier.dom_id(note)}") } let(:comment) { find("##{ActionView::RecordIdentifier.dom_id(note)}") }
...@@ -15,8 +15,14 @@ shared_examples 'reportable note' do ...@@ -15,8 +15,14 @@ shared_examples 'reportable note' do
dropdown = comment.find(more_actions_selector) dropdown = comment.find(more_actions_selector)
open_dropdown(dropdown) open_dropdown(dropdown)
if type == 'issue'
expect(dropdown).to have_button('Edit comment') expect(dropdown).to have_button('Edit comment')
expect(dropdown).to have_button('Delete 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) expect(dropdown).to have_link('Report as abuse', href: abuse_report_path)
end 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