summaryrefslogtreecommitdiff
path: root/spec/views/shared/notes/_form.html.haml_spec.rb
blob: d7d0a5bf56a9b992e78ecff60b276e12842b9a4f (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
require 'spec_helper'

describe 'shared/notes/_form' do
  include Devise::Test::ControllerHelpers

  let(:user) { create(:user) }
  let(:project) { create(:project, :repository) }

  before do
    project.team << [user, :master]
    assign(:project, project)
    assign(:note, note)

    allow(view).to receive(:current_user).and_return(user)

    render
  end

  %w[issue merge_request].each do |noteable|
    context "with a note on #{noteable}" do
      let(:note) { build(:"note_on_#{noteable}", project: project) }

      it 'says that markdown and slash commands are supported' do
        expect(rendered).to have_content('Markdown and slash commands are supported')
      end
    end
  end

  context 'with a note on a commit' do
    let(:note) { build(:note_on_commit, project: project) }

    it 'says that only markdown is supported, not slash commands' do
      expect(rendered).to have_content('Markdown is supported')
    end
  end
end