2016-09-13 17:45:13 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'layouts/_head' do
|
2018-03-17 18:26:18 +05:30
|
|
|
before do
|
|
|
|
allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings)
|
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'escapes HTML-safe strings in page_title' do
|
|
|
|
stub_helper_with_safe_string(:page_title)
|
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to match(%{content="foo" http-equiv="refresh"})
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'escapes HTML-safe strings in page_description' do
|
|
|
|
stub_helper_with_safe_string(:page_description)
|
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to match(%{content="foo" http-equiv="refresh"})
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'escapes HTML-safe strings in page_image' do
|
|
|
|
stub_helper_with_safe_string(:page_image)
|
|
|
|
|
|
|
|
render
|
|
|
|
|
|
|
|
expect(rendered).to match(%{content="foo" http-equiv="refresh"})
|
|
|
|
end
|
|
|
|
|
|
|
|
def stub_helper_with_safe_string(method)
|
|
|
|
allow_any_instance_of(PageLayoutHelper).to receive(method)
|
|
|
|
.and_return(%q{foo" http-equiv="refresh}.html_safe)
|
|
|
|
end
|
|
|
|
end
|