diff options
author | Alexandru Croitor <acroitor@gitlab.com> | 2019-02-20 18:18:15 +0300 |
---|---|---|
committer | Alexandru Croitor <acroitor@gitlab.com> | 2019-02-27 23:07:50 +0300 |
commit | 77985826d94454514c40b8da926e13b3b3791841 (patch) | |
tree | 00da4c2f5b72001e38b56e9d994cabc278ec0d7c /spec/support | |
parent | 177f9ca88b4d080e91b6c4ce2bba04d2fba95c07 (diff) |
Show header and footer system messages in email
* Add email_header_and_footer_enabled flag to appearances table
* Set email_header_and_footer_enabled default value to false
* Add checkbox to appearance to toggle show header and footer in emails
* Add email_header_and_footer_enabled to allowed params in controller
* Add header and footer messages to the html and text email layouts
* Remove the color styling for emails header and footer
* Add empty_mailer layout for emails without layout,
to have the header and footer applied
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/shared_examples/notify_shared_examples.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/support/shared_examples/notify_shared_examples.rb b/spec/support/shared_examples/notify_shared_examples.rb index a38354060cf..4fff1c4e228 100644 --- a/spec/support/shared_examples/notify_shared_examples.rb +++ b/spec/support/shared_examples/notify_shared_examples.rb @@ -252,3 +252,31 @@ shared_examples 'a note email' do end end end + +shared_examples 'appearance header and footer enabled' do + it "contains header and footer" do + create :appearance, header_message: "Foo", footer_message: "Bar", email_header_and_footer_enabled: true + + aggregate_failures do + expect(subject.html_part).to have_body_text("<div class=\"header-message\" style=\"\"><p>Foo</p></div>") + expect(subject.html_part).to have_body_text("<div class=\"footer-message\" style=\"\"><p>Bar</p></div>") + + expect(subject.text_part).to have_body_text(/^Foo/) + expect(subject.text_part).to have_body_text(/Bar$/) + end + end +end + +shared_examples 'appearance header and footer not enabled' do + it "does not contain header and footer" do + create :appearance, header_message: "Foo", footer_message: "Bar", email_header_and_footer_enabled: false + + aggregate_failures do + expect(subject.html_part).not_to have_body_text("<div class=\"header-message\" style=\"\"><p>Foo</p></div>") + expect(subject.html_part).not_to have_body_text("<div class=\"footer-message\" style=\"\"><p>Bar</p></div>") + + expect(subject.text_part).not_to have_body_text(/^Foo/) + expect(subject.text_part).not_to have_body_text(/Bar$/) + end + end +end |