summaryrefslogtreecommitdiff
path: root/spec/helpers/emails_helper_spec.rb
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
committerToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
commit62d7990b9bb30cf33ed87017c5c633d1cccc75c2 (patch)
treec3e1b69c58a412ba1c6f50a0337a23d9f9d6e1a4 /spec/helpers/emails_helper_spec.rb
parentf6453eca992a9c142268e78ac782cef98110d183 (diff)
downloadgitlab-ce-tc-standard-gem.tar.gz
Ran standardrb --fix on the whole codebasetc-standard-gem
Inspired by https://twitter.com/searls/status/1101137953743613952 I decided to try https://github.com/testdouble/standard on our codebase. It's opinionated, but at least it's a _standard_.
Diffstat (limited to 'spec/helpers/emails_helper_spec.rb')
-rw-r--r--spec/helpers/emails_helper_spec.rb118
1 files changed, 59 insertions, 59 deletions
diff --git a/spec/helpers/emails_helper_spec.rb b/spec/helpers/emails_helper_spec.rb
index 03b4c19ec22..7358cc0ebc5 100644
--- a/spec/helpers/emails_helper_spec.rb
+++ b/spec/helpers/emails_helper_spec.rb
@@ -1,94 +1,94 @@
-require 'spec_helper'
+require "spec_helper"
describe EmailsHelper do
- describe 'sanitize_name' do
- context 'when name contains a valid URL string' do
- it 'returns name with `.` replaced with `_` to prevent mail clients from auto-linking URLs' do
- expect(sanitize_name('https://about.gitlab.com')).to eq('https://about_gitlab_com')
- expect(sanitize_name('www.gitlab.com')).to eq('www_gitlab_com')
- expect(sanitize_name('//about.gitlab.com/handbook/security/#best-practices')).to eq('//about_gitlab_com/handbook/security/#best-practices')
+ describe "sanitize_name" do
+ context "when name contains a valid URL string" do
+ it "returns name with `.` replaced with `_` to prevent mail clients from auto-linking URLs" do
+ expect(sanitize_name("https://about.gitlab.com")).to eq("https://about_gitlab_com")
+ expect(sanitize_name("www.gitlab.com")).to eq("www_gitlab_com")
+ expect(sanitize_name("//about.gitlab.com/handbook/security/#best-practices")).to eq("//about_gitlab_com/handbook/security/#best-practices")
end
- it 'returns name as it is when it does not contain a URL' do
- expect(sanitize_name('Foo Bar')).to eq('Foo Bar')
+ it "returns name as it is when it does not contain a URL" do
+ expect(sanitize_name("Foo Bar")).to eq("Foo Bar")
end
end
end
- describe 'password_reset_token_valid_time' do
+ describe "password_reset_token_valid_time" do
def validate_time_string(time_limit, expected_string)
Devise.reset_password_within = time_limit
expect(password_reset_token_valid_time).to eq(expected_string)
end
- context 'when time limit is less than 2 hours' do
- it 'displays the time in hours using a singular unit' do
- validate_time_string(1.hour, '1 hour')
+ context "when time limit is less than 2 hours" do
+ it "displays the time in hours using a singular unit" do
+ validate_time_string(1.hour, "1 hour")
end
end
- context 'when time limit is 2 or more hours' do
- it 'displays the time in hours using a plural unit' do
- validate_time_string(2.hours, '2 hours')
+ context "when time limit is 2 or more hours" do
+ it "displays the time in hours using a plural unit" do
+ validate_time_string(2.hours, "2 hours")
end
end
- context 'when time limit contains fractions of an hour' do
- it 'rounds down to the nearest hour' do
- validate_time_string(96.minutes, '1 hour')
+ context "when time limit contains fractions of an hour" do
+ it "rounds down to the nearest hour" do
+ validate_time_string(96.minutes, "1 hour")
end
end
- context 'when time limit is 24 or more hours' do
- it 'displays the time in days using a singular unit' do
- validate_time_string(24.hours, '1 day')
+ context "when time limit is 24 or more hours" do
+ it "displays the time in days using a singular unit" do
+ validate_time_string(24.hours, "1 day")
end
end
- context 'when time limit is 2 or more days' do
- it 'displays the time in days using a plural unit' do
- validate_time_string(2.days, '2 days')
+ context "when time limit is 2 or more days" do
+ it "displays the time in days using a plural unit" do
+ validate_time_string(2.days, "2 days")
end
end
- context 'when time limit contains fractions of a day' do
- it 'rounds down to the nearest day' do
- validate_time_string(57.hours, '2 days')
+ context "when time limit contains fractions of a day" do
+ it "rounds down to the nearest day" do
+ validate_time_string(57.hours, "2 days")
end
end
end
- describe '#header_logo' do
- context 'there is a brand item with a logo' do
- it 'returns the brand header logo' do
- appearance = create :appearance, header_logo: fixture_file_upload('spec/fixtures/dk.png')
+ describe "#header_logo" do
+ context "there is a brand item with a logo" do
+ it "returns the brand header logo" do
+ appearance = create :appearance, header_logo: fixture_file_upload("spec/fixtures/dk.png")
expect(header_logo).to eq(
- %{<img style="height: 50px" src="/uploads/-/system/appearance/header_logo/#{appearance.id}/dk.png" alt="Dk" />}
+ %(<img style="height: 50px" src="/uploads/-/system/appearance/header_logo/#{appearance.id}/dk.png" alt="Dk" />)
)
end
end
- context 'there is a brand item without a logo' do
- it 'returns the default header logo' do
+ context "there is a brand item without a logo" do
+ it "returns the default header logo" do
create :appearance, header_logo: nil
expect(header_logo).to eq(
- %{<img alt="GitLab" src="/images/mailers/gitlab_header_logo.gif" width="55" height="50" />}
+ %(<img alt="GitLab" src="/images/mailers/gitlab_header_logo.gif" width="55" height="50" />)
)
end
end
- context 'there is no brand item' do
- it 'returns the default header logo' do
+ context "there is no brand item" do
+ it "returns the default header logo" do
expect(header_logo).to eq(
- %{<img alt="GitLab" src="/images/mailers/gitlab_header_logo.gif" width="55" height="50" />}
+ %(<img alt="GitLab" src="/images/mailers/gitlab_header_logo.gif" width="55" height="50" />)
)
end
end
end
- describe '#create_list_id_string' do
+ describe "#create_list_id_string" do
using RSpec::Parameterized::TableSyntax
where(:full_path, :list_id_path) do
@@ -108,7 +108,7 @@ describe EmailsHelper do
end
with_them do
- it 'ellipcizes different variants' do
+ it "ellipcizes different variants" do
project = double("project")
allow(project).to receive(:full_path).and_return(full_path)
allow(project).to receive(:id).and_return(12345)
@@ -122,7 +122,7 @@ describe EmailsHelper do
end
end
- describe 'Create realistic List-Id identifier' do
+ describe "Create realistic List-Id identifier" do
using RSpec::Parameterized::TableSyntax
where(:full_path, :list_id_path) do
@@ -131,7 +131,7 @@ describe EmailsHelper do
end
with_them do
- it 'Produces the right List-Id' do
+ it "Produces the right List-Id" do
project = double("project")
allow(project).to receive(:full_path).and_return(full_path)
allow(project).to receive(:id).and_return(12345)
@@ -143,22 +143,22 @@ describe EmailsHelper do
end
end
- describe 'header and footer messages' do
- context 'when email_header_and_footer_enabled is enabled' do
- it 'returns header and footer messages' do
- create :appearance, header_message: 'Foo', footer_message: 'Bar', email_header_and_footer_enabled: true
+ describe "header and footer messages" do
+ context "when email_header_and_footer_enabled is enabled" do
+ it "returns header and footer messages" do
+ create :appearance, header_message: "Foo", footer_message: "Bar", email_header_and_footer_enabled: true
aggregate_failures do
- expect(html_header_message).to eq(%{<div class="header-message" style=""><p>Foo</p></div>})
- expect(html_footer_message).to eq(%{<div class="footer-message" style=""><p>Bar</p></div>})
- expect(text_header_message).to eq('Foo')
- expect(text_footer_message).to eq('Bar')
+ expect(html_header_message).to eq(%(<div class="header-message" style=""><p>Foo</p></div>))
+ expect(html_footer_message).to eq(%(<div class="footer-message" style=""><p>Bar</p></div>))
+ expect(text_header_message).to eq("Foo")
+ expect(text_footer_message).to eq("Bar")
end
end
- context 'when header and footer messages are empty' do
- it 'returns nil' do
- create :appearance, header_message: '', footer_message: '', email_header_and_footer_enabled: true
+ context "when header and footer messages are empty" do
+ it "returns nil" do
+ create :appearance, header_message: "", footer_message: "", email_header_and_footer_enabled: true
aggregate_failures do
expect(html_header_message).to eq(nil)
@@ -169,8 +169,8 @@ describe EmailsHelper do
end
end
- context 'when header and footer messages are nil' do
- it 'returns nil' do
+ context "when header and footer messages are nil" do
+ it "returns nil" do
create :appearance, header_message: nil, footer_message: nil, email_header_and_footer_enabled: true
aggregate_failures do
@@ -183,9 +183,9 @@ describe EmailsHelper do
end
end
- context 'when email_header_and_footer_enabled is disabled' do
- it 'returns header and footer messages' do
- create :appearance, header_message: 'Foo', footer_message: 'Bar', email_header_and_footer_enabled: false
+ context "when email_header_and_footer_enabled is disabled" do
+ it "returns header and footer messages" do
+ create :appearance, header_message: "Foo", footer_message: "Bar", email_header_and_footer_enabled: false
aggregate_failures do
expect(html_header_message).to eq(nil)