From e4f7b87ddb4ba83456871eb83b841192b1b56799 Mon Sep 17 00:00:00 2001 From: Jarka Kadlecova Date: Wed, 3 May 2017 10:48:01 +0200 Subject: Support comments for personal snippets --- spec/views/shared/notes/_form.html.haml_spec.rb | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 spec/views/shared/notes/_form.html.haml_spec.rb (limited to 'spec/views/shared') diff --git a/spec/views/shared/notes/_form.html.haml_spec.rb b/spec/views/shared/notes/_form.html.haml_spec.rb new file mode 100644 index 00000000000..d7d0a5bf56a --- /dev/null +++ b/spec/views/shared/notes/_form.html.haml_spec.rb @@ -0,0 +1,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 -- cgit v1.2.1