debian-mirror-gitlab/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb

42 lines
1.5 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe 'projects/notes/_more_actions_dropdown' do
2017-09-10 17:25:29 +05:30
let(:author_user) { create(:user) }
let(:not_author_user) { create(:user) }
let(:project) { create(:project) }
let(:issue) { create(:issue, project: project) }
let!(:note) { create(:note_on_issue, author: author_user, noteable: issue, project: project) }
before do
assign(:project, project)
end
2019-09-04 21:01:54 +05:30
it 'shows Report abuse to admin button if not editable and not current users comment' do
2017-09-10 17:25:29 +05:30
render 'projects/notes/more_actions_dropdown', current_user: not_author_user, note_editable: false, note: note
2019-09-04 21:01:54 +05:30
expect(rendered).to have_link('Report abuse to admin')
2017-09-10 17:25:29 +05:30
end
it 'does not show the More actions button if not editable and current users comment' do
render 'projects/notes/more_actions_dropdown', current_user: author_user, note_editable: false, note: note
expect(rendered).not_to have_selector('.dropdown.more-actions')
end
2019-09-04 21:01:54 +05:30
it 'shows Report abuse to admin and Delete buttons if editable and not current users comment' do
2017-09-10 17:25:29 +05:30
render 'projects/notes/more_actions_dropdown', current_user: not_author_user, note_editable: true, note: note
2019-09-04 21:01:54 +05:30
expect(rendered).to have_link('Report abuse to admin')
2017-09-10 17:25:29 +05:30
expect(rendered).to have_link('Delete comment')
end
it 'shows Delete button if editable and current users comment' do
render 'projects/notes/more_actions_dropdown', current_user: author_user, note_editable: true, note: note
expect(rendered).to have_link('Delete comment')
end
end