Welcome to mirror list, hosted at ThFree Co, Russian Federation.

_more_actions_dropdown.html.haml_spec.rb « notes « projects « views « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7886a811c9a69726f036a2bee2b2aa4cfbcce869 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'projects/notes/_more_actions_dropdown' do
  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

  it 'shows Report abuse to admin button if not editable and not current users comment' do
    render 'projects/notes/more_actions_dropdown', current_user: not_author_user, note_editable: false, note: note

    expect(rendered).to have_link('Report abuse to administrator')
  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

  it 'shows Report abuse and Delete buttons if editable and not current users comment' do
    render 'projects/notes/more_actions_dropdown', current_user: not_author_user, note_editable: true, note: note

    expect(rendered).to have_link('Report abuse to administrator')
    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