diff options
author | Stan Hu <stanhu@gmail.com> | 2019-08-26 23:03:42 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-08-27 01:46:14 +0300 |
commit | f6058981919ab431e7c1e053b5ae6119a9a24e30 (patch) | |
tree | 9c30fd02530101d406388bc3755ee6ed8813a959 /spec/views | |
parent | f68730239765cefb565ba3242992813ca5d5be75 (diff) |
Fix Piwik not working
Due to indentation, the changes in
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31402 broke the
templating of Piwik script header.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66627
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/layouts/_head.html.haml_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/views/layouts/_head.html.haml_spec.rb b/spec/views/layouts/_head.html.haml_spec.rb index 70cdc08b4b6..d7f24950e6f 100644 --- a/spec/views/layouts/_head.html.haml_spec.rb +++ b/spec/views/layouts/_head.html.haml_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' describe 'layouts/_head' do + include StubConfiguration + before do allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) end @@ -87,6 +89,24 @@ describe 'layouts/_head' do end end + context 'when a Piwik config is set' do + let(:piwik_host) { 'piwik.example.com' } + + before do + stub_config(extra: { + piwik_url: piwik_host, + piwik_site_id: 12345 + }) + end + + it 'add a Piwik Javascript' do + render + + expect(rendered).to match(/<script.*>.*var u="\/\/#{piwik_host}\/".*<\/script>/m) + expect(rendered).to match(%r(<noscript>.*<img src="//#{piwik_host}/piwik.php.*</noscript>)) + end + 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) |