diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 00:06:28 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 00:06:28 +0000 |
commit | 10d0e5693c0eed9fd9c40f4fadeda187237db6b5 (patch) | |
tree | 82a723f14e4a44146c7c5e2259b9c7d6d9b834bb /spec/views/layouts | |
parent | a19a376bf35b2009566e86b8190662c21ed7e2ba (diff) | |
download | gitlab-ce-10d0e5693c0eed9fd9c40f4fadeda187237db6b5.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views/layouts')
-rw-r--r-- | spec/views/layouts/application.html.haml_spec.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/views/layouts/application.html.haml_spec.rb b/spec/views/layouts/application.html.haml_spec.rb new file mode 100644 index 00000000000..bdd4a97a1f5 --- /dev/null +++ b/spec/views/layouts/application.html.haml_spec.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'layouts/application' do + let(:user) { create(:user) } + + before do + allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:experiment_enabled?).and_return(false) + allow(view).to receive(:session).and_return({}) + allow(view).to receive(:user_signed_in?).and_return(true) + allow(view).to receive(:current_user).and_return(user) + end + + context 'body data elements for pageview context' do + let(:body_data) do + { + body_data_page: 'projects:issues:show', + body_data_page_type_id: '1', + body_data_project_id: '2', + body_data_namespace_id: '3' + } + end + + before do + allow(view).to receive(:body_data).and_return(body_data) + render + end + + it 'includes the body element page' do + expect(rendered).to include('data-page="projects:issues:show"') + end + + it 'includes the body element page_type_id' do + expect(rendered).to include('data-page-type-id="1"') + end + + it 'includes the body element project_id' do + expect(rendered).to include('data-project-id="2"') + end + + it 'includes the body element namespace_id' do + expect(rendered).to include('data-namespace-id="3"') + end + end +end |