gitlab-org--gitlab-foss/spec/features/help_pages_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
1.9 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Help Pages' do
describe 'Get the main help page' do
before do
allow(File).to receive(:read).and_call_original
allow(File).to receive(:read).with(Rails.root.join('doc', 'README.md')).and_return(fixture_file('sample_doc.md'))
end
2017-12-19 16:18:48 +00:00
context 'quick link shortcuts', :js do
before do
visit help_path
end
it 'focuses search bar' do
find('.js-trigger-search-bar').click
expect(page).to have_selector('#search:focus')
end
it 'opens shortcuts help dialog' do
find('.js-trigger-shortcut').click
expect(page).to have_selector('[data-testid="modal-shortcuts"]')
2017-12-19 16:18:48 +00:00
end
end
end
2017-01-12 14:00:06 +00:00
describe 'with version check enabled' do
let_it_be(:user) { create(:user) }
2017-01-12 14:00:06 +00:00
before do
stub_application_setting(version_check_enabled: true)
allow(User).to receive(:single_user).and_return(double(user, requires_usage_stats_consent?: false))
allow(user).to receive(:can_read_all_resources?).and_return(true)
sign_in(user)
2017-01-12 14:00:06 +00:00
visit help_path
end
it 'renders the version check badge' do
expect(page).to have_selector('.js-gitlab-version-check-badge')
2017-01-12 14:00:06 +00:00
end
end
2017-06-13 16:46:02 +00:00
describe 'when help page is customized' do
before do
stub_application_setting(help_page_hide_commercial_content: true,
help_page_text: 'My Custom Text',
help_page_support_url: 'http://example.com/help')
2017-06-13 16:46:02 +00:00
sign_in(create(:user))
2017-06-13 16:46:02 +00:00
visit help_path
end
it 'displays custom help page text' do
2017-06-13 16:46:02 +00:00
expect(page).to have_text "My Custom Text"
end
it 'hides marketing content when enabled' do
2017-06-13 16:46:02 +00:00
expect(page).not_to have_link "Get a support subscription"
end
it 'uses a custom support url' do
expect(page).to have_link "See our website for help", href: "http://example.com/help"
2017-06-13 16:46:02 +00:00
end
end
end