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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/help_controller_spec.rb')
-rw-r--r--spec/controllers/help_controller_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb
index 26e65711e9f..2375146f346 100644
--- a/spec/controllers/help_controller_spec.rb
+++ b/spec/controllers/help_controller_spec.rb
@@ -139,6 +139,39 @@ RSpec.describe HelpController do
end
end
+ describe 'GET #drawers' do
+ subject { get :drawers, params: { markdown_file: path } }
+
+ context 'when requested file exists' do
+ let(:path) { 'user/ssh' }
+ let(:file_name) { "#{path}.md" }
+
+ before do
+ subject
+ end
+
+ it 'assigns variables', :aggregate_failures do
+ expect(assigns[:path]).not_to be_empty
+ expect(assigns[:clean_path]).not_to be_empty
+ end
+
+ it 'renders HTML', :aggregate_failures do
+ is_expected.to render_template('help/drawers')
+ expect(response.media_type).to eq 'text/html'
+ end
+ end
+
+ context 'when requested file is missing' do
+ let(:path) { 'foo/bar' }
+
+ it 'renders not found' do
+ subject
+
+ expect(response).to be_not_found
+ end
+ end
+ end
+
describe 'GET #show' do
context 'for Markdown formats' do
subject { get :show, params: { path: path }, format: :md }