gitlab-org--gitlab-foss/spec/features/help_pages_spec.rb
Rémy Coutable 448fc23e47
Let PhantomJS load local images
This change fix a memory leak due to a Webkit bug:
https://github.com/ariya/phantomjs/issues/12903

Also:

- Whitelist only localhost and 127.0.0.1 in Capybara + JS specs
- Blacklist all requests to media such as images, videos, PDFs, CSVs etc.
- Log all the requests made.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-06-12 19:00:03 +02:00

56 lines
1.5 KiB
Ruby

require 'spec_helper'
describe 'Help Pages', feature: true do
describe 'Get the main help page' do
shared_examples_for 'help page' do |prefix: ''|
it 'prefixes links correctly' do
expect(page).to have_selector(%(div.documentation-index > ul a[href="#{prefix}/help/api/README.md"]))
end
end
context 'without a trailing slash' do
before do
visit help_path
end
it_behaves_like 'help page'
end
context 'with a trailing slash' do
before do
visit help_path + '/'
end
it_behaves_like 'help page'
end
context 'with a relative installation' do
before do
stub_config_setting(relative_url_root: '/gitlab')
visit help_path
end
it_behaves_like 'help page', prefix: '/gitlab'
end
end
context 'in a production environment with version check enabled', :js do
before do
allow(Rails.env).to receive(:production?) { true }
allow(current_application_settings).to receive(:version_check_enabled) { true }
allow_any_instance_of(VersionCheck).to receive(:url) { '/version-check-url' }
login_as :user
visit help_path
end
it 'has a version check image' do
expect(find('.js-version-status-badge', visible: false)['src']).to end_with('/version-check-url')
end
it 'hides the version check image if the image request fails' do
# We use '--load-images=yes' with poltergeist so the image fails to load
expect(find('.js-version-status-badge', visible: false)).not_to be_visible
end
end
end