diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-04-20 10:56:41 +0200 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-04-26 12:51:06 +0200 |
commit | 87327c5845a7feec92e546dc0da42282ac27de40 (patch) | |
tree | 87134624b3911bf49b2799fecd89f4a4334dc0c9 /spec/controllers | |
parent | a9da37434af6d44c5f851affd4bd69b370760e8e (diff) | |
download | gitlab-ce-87327c5845a7feec92e546dc0da42282ac27de40.tar.gz |
Support preview_markdown action for personal_snippets
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/wikis_controller_spec.rb | 16 | ||||
-rw-r--r-- | spec/controllers/projects_controller_spec.rb | 10 | ||||
-rw-r--r-- | spec/controllers/snippets_controller_spec.rb | 12 |
3 files changed, 38 insertions, 0 deletions
diff --git a/spec/controllers/projects/wikis_controller_spec.rb b/spec/controllers/projects/wikis_controller_spec.rb new file mode 100644 index 00000000000..92addf30307 --- /dev/null +++ b/spec/controllers/projects/wikis_controller_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe Projects::WikisController do + let(:project) { create(:project_empty_repo, :public) } + let(:user) { create(:user) } + + describe 'POST #preview_markdown' do + it 'renders json in a correct format' do + sign_in(user) + + post :preview_markdown, namespace_id: project.namespace, project_id: project, id: 'page/path', text: '*Markdown* text' + + expect(JSON.parse(response.body).keys).to match_array(%w(body references)) + end + end +end diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index a88ffc1ea6a..eafc2154568 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -398,4 +398,14 @@ describe ProjectsController do expect(parsed_body["Commits"]).to include("123456") end end + + describe 'POST #preview_markdown' do + it 'renders json in a correct format' do + sign_in(user) + + post :preview_markdown, namespace_id: public_project.namespace, id: public_project, text: '*Markdown* text' + + expect(JSON.parse(response.body).keys).to match_array(%w(body references)) + end + end end diff --git a/spec/controllers/snippets_controller_spec.rb b/spec/controllers/snippets_controller_spec.rb index 5de3b9890ef..234f3edd3d8 100644 --- a/spec/controllers/snippets_controller_spec.rb +++ b/spec/controllers/snippets_controller_spec.rb @@ -521,4 +521,16 @@ describe SnippetsController do end end end + + describe 'POST #preview_markdown' do + let(:snippet) { create(:personal_snippet, :public) } + + it 'renders json in a correct format' do + sign_in(user) + + post :preview_markdown, id: snippet, text: '*Markdown* text' + + expect(JSON.parse(response.body).keys).to match_array(%w(body references)) + end + end end |