2016-09-29 09:46:39 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
describe 'shared/notes/_form' do
|
2016-11-03 12:29:30 +05:30
|
|
|
include Devise::Test::ControllerHelpers
|
2016-09-29 09:46:39 +05:30
|
|
|
|
|
|
|
let(:user) { create(:user) }
|
2017-08-17 22:00:37 +05:30
|
|
|
let(:project) { create(:project, :repository) }
|
2016-09-29 09:46:39 +05:30
|
|
|
|
|
|
|
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) }
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
it 'says that markdown and slash commands are supported' do
|
|
|
|
expect(rendered).to have_content('Markdown and slash commands are supported')
|
2016-09-29 09:46:39 +05:30
|
|
|
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
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(rendered).to have_content('Markdown is supported')
|
2016-09-29 09:46:39 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|