Commit af121756 authored by Douwe Maan's avatar Douwe Maan

Revert "Enable Style/BarePercentLiterals"

This reverts commit 96bef54154e669f9a3e92c3a4bc76c0be3a52e48.
parent 37840bdd
...@@ -77,10 +77,6 @@ Style/AsciiIdentifiers: ...@@ -77,10 +77,6 @@ Style/AsciiIdentifiers:
Style/Attr: Style/Attr:
Enabled: true Enabled: true
# This cop checks if usage of %() or %Q() matches configuration.
Style/BarePercentLiterals:
Enabled: true
# Avoid the use of BEGIN blocks. # Avoid the use of BEGIN blocks.
Style/BeginBlock: Style/BeginBlock:
Enabled: true Enabled: true
......
...@@ -63,6 +63,13 @@ Rails/SkipsModelValidations: ...@@ -63,6 +63,13 @@ Rails/SkipsModelValidations:
# Cop supports --auto-correct. # Cop supports --auto-correct.
Security/YAMLLoad: Security/YAMLLoad:
Enabled: false Enabled: false
# Offense count: 55
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: percent_q, bare_percent
Style/BarePercentLiterals:
Enabled: false
# Offense count: 9 # Offense count: 9
# Cop supports --auto-correct. # Cop supports --auto-correct.
......
...@@ -155,7 +155,7 @@ module CommitsHelper ...@@ -155,7 +155,7 @@ module CommitsHelper
text = text =
if options[:avatar] if options[:avatar]
%{<span class="commit-#{options[:source]}-name">#{person_name}</span>} %Q{<span class="commit-#{options[:source]}-name">#{person_name}</span>}
else else
person_name person_name
end end
......
...@@ -256,7 +256,7 @@ class Commit ...@@ -256,7 +256,7 @@ class Commit
end end
def revert_message(user) def revert_message(user)
%{Revert "#{title.strip}"\n\n#{revert_description(user)}} %Q{Revert "#{title.strip}"\n\n#{revert_description(user)}}
end end
def reverts_commit?(commit, user) def reverts_commit?(commit, user)
......
...@@ -5,7 +5,7 @@ class MigrateUsersNotificationLevel < ActiveRecord::Migration ...@@ -5,7 +5,7 @@ class MigrateUsersNotificationLevel < ActiveRecord::Migration
DOWNTIME = false DOWNTIME = false
def up def up
execute(%{ execute(%Q{
INSERT INTO notification_settings INSERT INTO notification_settings
(user_id, level, created_at, updated_at) (user_id, level, created_at, updated_at)
(SELECT id, notification_level, created_at, updated_at FROM users WHERE notification_level != 1) (SELECT id, notification_level, created_at, updated_at FROM users WHERE notification_level != 1)
...@@ -15,7 +15,7 @@ class MigrateUsersNotificationLevel < ActiveRecord::Migration ...@@ -15,7 +15,7 @@ class MigrateUsersNotificationLevel < ActiveRecord::Migration
# Migrates from notification settings back to user notification_level # Migrates from notification settings back to user notification_level
# If no value is found the default level of 1 will be used # If no value is found the default level of 1 will be used
def down def down
execute(%{ execute(%Q{
UPDATE users u SET UPDATE users u SET
notification_level = COALESCE((SELECT level FROM notification_settings WHERE user_id = u.id AND source_type IS NULL), 1) notification_level = COALESCE((SELECT level FROM notification_settings WHERE user_id = u.id AND source_type IS NULL), 1)
}) })
......
...@@ -10,7 +10,7 @@ class MigrateProjectFeatures < ActiveRecord::Migration ...@@ -10,7 +10,7 @@ class MigrateProjectFeatures < ActiveRecord::Migration
def up def up
sql = sql =
%{ %Q{
INSERT INTO project_features(project_id, issues_access_level, merge_requests_access_level, wiki_access_level, INSERT INTO project_features(project_id, issues_access_level, merge_requests_access_level, wiki_access_level,
builds_access_level, snippets_access_level, created_at, updated_at) builds_access_level, snippets_access_level, created_at, updated_at)
SELECT SELECT
...@@ -29,7 +29,7 @@ class MigrateProjectFeatures < ActiveRecord::Migration ...@@ -29,7 +29,7 @@ class MigrateProjectFeatures < ActiveRecord::Migration
end end
def down def down
sql = %{ sql = %Q{
UPDATE projects UPDATE projects
SET SET
issues_enabled = COALESCE((SELECT CASE WHEN issues_access_level = 20 THEN true ELSE false END AS issues_enabled FROM project_features WHERE project_features.project_id = projects.id), true), issues_enabled = COALESCE((SELECT CASE WHEN issues_access_level = 20 THEN true ELSE false END AS issues_enabled FROM project_features WHERE project_features.project_id = projects.id), true),
......
...@@ -27,6 +27,6 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps ...@@ -27,6 +27,6 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
def expect_badge(status) def expect_badge(status)
svg = Nokogiri::XML.parse(page.body) svg = Nokogiri::XML.parse(page.body)
expect(page.response_headers['Content-Type']).to include('image/svg+xml') expect(page.response_headers['Content-Type']).to include('image/svg+xml')
expect(svg.at(%{text:contains("#{status}")})).to be_truthy expect(svg.at(%Q{text:contains("#{status}")})).to be_truthy
end end
end end
...@@ -32,7 +32,7 @@ module Banzai ...@@ -32,7 +32,7 @@ module Banzai
IGNORE_PARENTS = %w(a code kbd pre script style).to_set IGNORE_PARENTS = %w(a code kbd pre script style).to_set
# The XPath query to use for finding text nodes to parse. # The XPath query to use for finding text nodes to parse.
TEXT_QUERY = %(descendant-or-self::text()[ TEXT_QUERY = %Q(descendant-or-self::text()[
not(#{IGNORE_PARENTS.map { |p| "ancestor::#{p}" }.join(' or ')}) not(#{IGNORE_PARENTS.map { |p| "ancestor::#{p}" }.join(' or ')})
and contains(., '://') and contains(., '://')
and not(starts-with(., 'http')) and not(starts-with(., 'http'))
......
...@@ -32,7 +32,7 @@ module Banzai ...@@ -32,7 +32,7 @@ module Banzai
attributes[:reference_type] ||= self.class.reference_type attributes[:reference_type] ||= self.class.reference_type
attributes.delete(:original) if context[:no_original_data] attributes.delete(:original) if context[:no_original_data]
attributes.map do |key, value| attributes.map do |key, value|
%(data-#{key.to_s.dasherize}="#{escape_once(value)}") %Q(data-#{key.to_s.dasherize}="#{escape_once(value)}")
end.join(' ') end.join(' ')
end end
...@@ -76,7 +76,7 @@ module Banzai ...@@ -76,7 +76,7 @@ module Banzai
def each_node def each_node
return to_enum(__method__) unless block_given? return to_enum(__method__) unless block_given?
query = %{descendant-or-self::text()[not(#{ignore_ancestor_query})] query = %Q{descendant-or-self::text()[not(#{ignore_ancestor_query})]
| descendant-or-self::a[ | descendant-or-self::a[
not(contains(concat(" ", @class, " "), " gfm ")) and not(@href = "") not(contains(concat(" ", @class, " "), " gfm ")) and not(@href = "")
]} ]}
......
...@@ -43,7 +43,7 @@ module Banzai ...@@ -43,7 +43,7 @@ module Banzai
end end
end end
result[:toc] = %{<ul class="section-nav">\n#{result[:toc]}</ul>} unless result[:toc].empty? result[:toc] = %Q{<ul class="section-nav">\n#{result[:toc]}</ul>} unless result[:toc].empty?
doc doc
end end
...@@ -51,11 +51,11 @@ module Banzai ...@@ -51,11 +51,11 @@ module Banzai
private private
def anchor_tag(id, href) def anchor_tag(id, href)
%{<a id="#{id}" class="anchor" href="##{href}" aria-hidden="true"></a>} %Q{<a id="#{id}" class="anchor" href="##{href}" aria-hidden="true"></a>}
end end
def push_toc(href, text) def push_toc(href, text)
result[:toc] << %{<li><a href="##{href}">#{text}</a></li>\n} result[:toc] << %Q{<li><a href="##{href}">#{text}</a></li>\n}
end end
end end
end end
......
...@@ -100,13 +100,13 @@ module Gitlab ...@@ -100,13 +100,13 @@ module Gitlab
end end
def extract_epoch(arel_attribute) def extract_epoch(arel_attribute)
Arel.sql(%{EXTRACT(EPOCH FROM "#{arel_attribute.relation.name}"."#{arel_attribute.name}")}) Arel.sql(%Q{EXTRACT(EPOCH FROM "#{arel_attribute.relation.name}"."#{arel_attribute.name}")})
end end
def extract_diff_epoch(diff) def extract_diff_epoch(diff)
return diff unless Gitlab::Database.postgresql? return diff unless Gitlab::Database.postgresql?
Arel.sql(%{EXTRACT(EPOCH FROM (#{diff.to_sql}))}) Arel.sql(%Q{EXTRACT(EPOCH FROM (#{diff.to_sql}))})
end end
# Need to cast '0' to an INTERVAL before we can check if the interval is positive # Need to cast '0' to an INTERVAL before we can check if the interval is positive
......
...@@ -77,6 +77,6 @@ feature 'test coverage badge' do ...@@ -77,6 +77,6 @@ feature 'test coverage badge' do
def expect_coverage_badge(coverage) def expect_coverage_badge(coverage)
svg = Nokogiri::XML.parse(page.body) svg = Nokogiri::XML.parse(page.body)
expect(page.response_headers['Content-Type']).to include('image/svg+xml') expect(page.response_headers['Content-Type']).to include('image/svg+xml')
expect(svg.at(%{text:contains("#{coverage}")})).to be_truthy expect(svg.at(%Q{text:contains("#{coverage}")})).to be_truthy
end end
end end
...@@ -13,7 +13,7 @@ feature 'issuable templates', feature: true, js: true do ...@@ -13,7 +13,7 @@ feature 'issuable templates', feature: true, js: true do
context 'user creates an issue using templates' do context 'user creates an issue using templates' do
let(:template_content) { 'this is a test "bug" template' } let(:template_content) { 'this is a test "bug" template' }
let(:longtemplate_content) { %(this\n\n\n\n\nis\n\n\n\n\na\n\n\n\n\nbug\n\n\n\n\ntemplate) } let(:longtemplate_content) { %Q(this\n\n\n\n\nis\n\n\n\n\na\n\n\n\n\nbug\n\n\n\n\ntemplate) }
let(:issue) { create(:issue, author: user, assignee: user, project: project) } let(:issue) { create(:issue, author: user, assignee: user, project: project) }
let(:description_addition) { ' appending to description' } let(:description_addition) { ' appending to description' }
......
...@@ -110,7 +110,7 @@ describe 'Pipelines', :feature, :js do ...@@ -110,7 +110,7 @@ describe 'Pipelines', :feature, :js do
it 'contains badge with tooltip which contains error' do it 'contains badge with tooltip which contains error' do
expect(pipeline).to have_yaml_errors expect(pipeline).to have_yaml_errors
expect(page).to have_selector( expect(page).to have_selector(
%{span[data-original-title="#{pipeline.yaml_errors}"]}) %Q{span[data-original-title="#{pipeline.yaml_errors}"]})
end end
end end
......
...@@ -23,7 +23,7 @@ describe BlobHelper do ...@@ -23,7 +23,7 @@ describe BlobHelper do
end end
it 'highlights single block' do it 'highlights single block' do
expected = %[<pre class="code highlight"><code><span id="LC1" class="line"><span class="p">(</span><span class="nb">make-pathname</span> <span class="ss">:defaults</span> <span class="nv">name</span></span> expected = %Q[<pre class="code highlight"><code><span id="LC1" class="line"><span class="p">(</span><span class="nb">make-pathname</span> <span class="ss">:defaults</span> <span class="nv">name</span></span>
<span id="LC2" class="line"><span class="ss">:type</span> <span class="s">"assem"</span><span class="p">))</span></span></code></pre>] <span id="LC2" class="line"><span class="ss">:type</span> <span class="s">"assem"</span><span class="p">))</span></span></code></pre>]
expect(helper.highlight(blob_name, blob_content)).to eq(expected) expect(helper.highlight(blob_name, blob_content)).to eq(expected)
......
...@@ -107,13 +107,13 @@ describe GitlabMarkdownHelper do ...@@ -107,13 +107,13 @@ describe GitlabMarkdownHelper do
it 'ignores reference links when they are the entire body' do it 'ignores reference links when they are the entire body' do
text = issues[0].to_reference text = issues[0].to_reference
act = helper.link_to_gfm(text, '/foo') act = helper.link_to_gfm(text, '/foo')
expect(act).to eq %(<a href="/foo">#{issues[0].to_reference}</a>) expect(act).to eq %Q(<a href="/foo">#{issues[0].to_reference}</a>)
end end
it 'replaces commit message with emoji to link' do it 'replaces commit message with emoji to link' do
actual = link_to_gfm(':book:Book', '/foo') actual = link_to_gfm(':book:Book', '/foo')
expect(actual) expect(actual)
.to eq %(<img class="emoji" title=":book:" alt=":book:" src="http://#{Gitlab.config.gitlab.host}/assets/1F4D6.png" height="20" width="20" align="absmiddle"><a href="/foo">Book</a>) .to eq %Q(<img class="emoji" title=":book:" alt=":book:" src="http://#{Gitlab.config.gitlab.host}/assets/1F4D6.png" height="20" width="20" align="absmiddle"><a href="/foo">Book</a>)
end end
end end
......
...@@ -15,7 +15,7 @@ describe Banzai::Filter::ExternalLinkFilter, lib: true do ...@@ -15,7 +15,7 @@ describe Banzai::Filter::ExternalLinkFilter, lib: true do
it 'skips internal links' do it 'skips internal links' do
internal = Gitlab.config.gitlab.url internal = Gitlab.config.gitlab.url
exp = act = %(<a href="#{internal}/sign_in">Login</a>) exp = act = %Q(<a href="#{internal}/sign_in">Login</a>)
expect(filter(act).to_html).to eq exp expect(filter(act).to_html).to eq exp
end end
...@@ -70,8 +70,8 @@ describe Banzai::Filter::ExternalLinkFilter, lib: true do ...@@ -70,8 +70,8 @@ describe Banzai::Filter::ExternalLinkFilter, lib: true do
it 'skips internal links' do it 'skips internal links' do
internal_link = Gitlab.config.gitlab.url + "/sign_in" internal_link = Gitlab.config.gitlab.url + "/sign_in"
url = internal_link.gsub(/\Ahttp/, 'HtTp') url = internal_link.gsub(/\Ahttp/, 'HtTp')
act = %(<a href="#{url}">Login</a>) act = %Q(<a href="#{url}">Login</a>)
exp = %(<a href="#{internal_link}">Login</a>) exp = %Q(<a href="#{internal_link}">Login</a>)
expect(filter(act).to_html).to eq(exp) expect(filter(act).to_html).to eq(exp)
end end
......
...@@ -282,7 +282,7 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do ...@@ -282,7 +282,7 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do
end end
describe 'referencing a label in a link href' do describe 'referencing a label in a link href' do
let(:reference) { %{<a href="#{label.to_reference}">Label</a>} } let(:reference) { %Q{<a href="#{label.to_reference}">Label</a>} }
it 'links to a valid reference' do it 'links to a valid reference' do
doc = reference_filter("See #{reference}") doc = reference_filter("See #{reference}")
......
...@@ -117,7 +117,7 @@ describe Banzai::Filter::MilestoneReferenceFilter, lib: true do ...@@ -117,7 +117,7 @@ describe Banzai::Filter::MilestoneReferenceFilter, lib: true do
end end
describe 'referencing a milestone in a link href' do describe 'referencing a milestone in a link href' do
let(:reference) { %{<a href="#{milestone.to_reference}">Milestone</a>} } let(:reference) { %Q{<a href="#{milestone.to_reference}">Milestone</a>} }
it 'links to a valid reference' do it 'links to a valid reference' do
doc = reference_filter("See #{reference}") doc = reference_filter("See #{reference}")
......
...@@ -144,7 +144,7 @@ describe Banzai::Filter::UserReferenceFilter, lib: true do ...@@ -144,7 +144,7 @@ describe Banzai::Filter::UserReferenceFilter, lib: true do
end end
context 'referencing a user in a link href' do context 'referencing a user in a link href' do
let(:reference) { %{<a href="#{user.to_reference}">User</a>} } let(:reference) { %Q{<a href="#{user.to_reference}">User</a>} }
it 'links to a User' do it 'links to a User' do
doc = reference_filter("Hey #{reference}") doc = reference_filter("Hey #{reference}")
......
...@@ -20,7 +20,7 @@ describe Banzai::Pipeline::FullPipeline do ...@@ -20,7 +20,7 @@ describe Banzai::Pipeline::FullPipeline do
end end
it 'escapes the data-original attribute on a reference' do it 'escapes the data-original attribute on a reference' do
markdown = %{[">bad things](#{issue.to_reference})} markdown = %Q{[">bad things](#{issue.to_reference})}
result = described_class.to_html(markdown, project: project) result = described_class.to_html(markdown, project: project)
expect(result).to include(%{data-original='\"&gt;bad things'}) expect(result).to include(%{data-original='\"&gt;bad things'})
end end
......
...@@ -22,19 +22,19 @@ describe Gitlab::Diff::Highlight, lib: true do ...@@ -22,19 +22,19 @@ describe Gitlab::Diff::Highlight, lib: true do
end end
it 'highlights and marks unchanged lines' do it 'highlights and marks unchanged lines' do
code = %{ <span id="LC7" class="line"> <span class="k">def</span> <span class="nf">popen</span><span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="kp">nil</span><span class="p">)</span></span>\n} code = %Q{ <span id="LC7" class="line"> <span class="k">def</span> <span class="nf">popen</span><span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="kp">nil</span><span class="p">)</span></span>\n}
expect(subject[2].text).to eq(code) expect(subject[2].text).to eq(code)
end end
it 'highlights and marks removed lines' do it 'highlights and marks removed lines' do
code = %{-<span id="LC9" class="line"> <span class="k">raise</span> <span class="s2">"System commands must be given as an array of strings"</span></span>\n} code = %Q{-<span id="LC9" class="line"> <span class="k">raise</span> <span class="s2">"System commands must be given as an array of strings"</span></span>\n}
expect(subject[4].text).to eq(code) expect(subject[4].text).to eq(code)
end end
it 'highlights and marks added lines' do it 'highlights and marks added lines' do
code = %{+<span id="LC9" class="line"> <span class="k">raise</span> <span class="no"><span class='idiff left'>RuntimeError</span></span><span class="p"><span class='idiff'>,</span></span><span class='idiff right'> </span><span class="s2">"System commands must be given as an array of strings"</span></span>\n} code = %Q{+<span id="LC9" class="line"> <span class="k">raise</span> <span class="no"><span class='idiff left'>RuntimeError</span></span><span class="p"><span class='idiff'>,</span></span><span class='idiff right'> </span><span class="s2">"System commands must be given as an array of strings"</span></span>\n}
expect(subject[5].text).to eq(code) expect(subject[5].text).to eq(code)
end end
...@@ -53,21 +53,21 @@ describe Gitlab::Diff::Highlight, lib: true do ...@@ -53,21 +53,21 @@ describe Gitlab::Diff::Highlight, lib: true do
end end
it 'marks unchanged lines' do it 'marks unchanged lines' do
code = %{ def popen(cmd, path=nil)} code = %q{ def popen(cmd, path=nil)}
expect(subject[2].text).to eq(code) expect(subject[2].text).to eq(code)
expect(subject[2].text).not_to be_html_safe expect(subject[2].text).not_to be_html_safe
end end
it 'marks removed lines' do it 'marks removed lines' do
code = %{- raise "System commands must be given as an array of strings"} code = %q{- raise "System commands must be given as an array of strings"}
expect(subject[4].text).to eq(code) expect(subject[4].text).to eq(code)
expect(subject[4].text).not_to be_html_safe expect(subject[4].text).not_to be_html_safe
end end
it 'marks added lines' do it 'marks added lines' do
code = %{+ raise <span class='idiff left right'>RuntimeError, </span>&quot;System commands must be given as an array of strings&quot;} code = %q{+ raise <span class='idiff left right'>RuntimeError, </span>&quot;System commands must be given as an array of strings&quot;}
expect(subject[5].text).to eq(code) expect(subject[5].text).to eq(code)
expect(subject[5].text).to be_html_safe expect(subject[5].text).to be_html_safe
......
...@@ -68,12 +68,12 @@ describe Gitlab::Gfm::ReferenceRewriter do ...@@ -68,12 +68,12 @@ describe Gitlab::Gfm::ReferenceRewriter do
context 'label referenced by id' do context 'label referenced by id' do
let(:text) { '#1 and ~123' } let(:text) { '#1 and ~123' }
it { is_expected.to eq %{#{project_ref}#1 and #{project_ref}~123} } it { is_expected.to eq %Q{#{project_ref}#1 and #{project_ref}~123} }
end end
context 'label referenced by text' do context 'label referenced by text' do
let(:text) { '#1 and ~"test"' } let(:text) { '#1 and ~"test"' }
it { is_expected.to eq %{#{project_ref}#1 and #{project_ref}~123} } it { is_expected.to eq %Q{#{project_ref}#1 and #{project_ref}~123} }
end end
end end
...@@ -88,12 +88,12 @@ describe Gitlab::Gfm::ReferenceRewriter do ...@@ -88,12 +88,12 @@ describe Gitlab::Gfm::ReferenceRewriter do
context 'label referenced by id' do context 'label referenced by id' do
let(:text) { '#1 and ~321' } let(:text) { '#1 and ~321' }
it { is_expected.to eq %{#{project_ref}#1 and #{project_ref}~321} } it { is_expected.to eq %Q{#{project_ref}#1 and #{project_ref}~321} }
end end
context 'label referenced by text' do context 'label referenced by text' do
let(:text) { '#1 and ~"group label"' } let(:text) { '#1 and ~"group label"' }
it { is_expected.to eq %{#{project_ref}#1 and #{project_ref}~321} } it { is_expected.to eq %Q{#{project_ref}#1 and #{project_ref}~321} }
end end
end end
end end
......
...@@ -13,9 +13,9 @@ describe Gitlab::Highlight, lib: true do ...@@ -13,9 +13,9 @@ describe Gitlab::Highlight, lib: true do
end end
it 'highlights all the lines properly' do it 'highlights all the lines properly' do
expect(lines[4]).to eq(%{<span id="LC5" class="line"> <span class="kp">extend</span> <span class="nb">self</span></span>\n}) expect(lines[4]).to eq(%Q{<span id="LC5" class="line"> <span class="kp">extend</span> <span class="nb">self</span></span>\n})
expect(lines[21]).to eq(%{<span id="LC22" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>\n}) expect(lines[21]).to eq(%Q{<span id="LC22" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>\n})
expect(lines[26]).to eq(%{<span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>\n}) expect(lines[26]).to eq(%Q{<span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>\n})
end end
describe 'with CRLF' do describe 'with CRLF' do
......
...@@ -29,7 +29,7 @@ describe Gitlab::ReferenceExtractor, lib: true do ...@@ -29,7 +29,7 @@ describe Gitlab::ReferenceExtractor, lib: true do
project.team << [@u_foo, :reporter] project.team << [@u_foo, :reporter]
project.team << [@u_bar, :guest] project.team << [@u_bar, :guest]
subject.analyze(%{ subject.analyze(%Q{
Inline code: `@foo` Inline code: `@foo`
Code block: Code block:
......
...@@ -9,7 +9,7 @@ describe Gitlab::UrlSanitizer, lib: true do ...@@ -9,7 +9,7 @@ describe Gitlab::UrlSanitizer, lib: true do
describe '.sanitize' do describe '.sanitize' do
def sanitize_url(url) def sanitize_url(url)
# We want to try with multi-line content because is how error messages are formatted # We want to try with multi-line content because is how error messages are formatted
described_class.sanitize(%{ described_class.sanitize(%Q{
remote: Not Found remote: Not Found
fatal: repository '#{url}' not found fatal: repository '#{url}' not found
}) })
......
...@@ -105,14 +105,14 @@ describe ProjectLabel, models: true do ...@@ -105,14 +105,14 @@ describe ProjectLabel, models: true do
context 'using name' do context 'using name' do
it 'returns cross reference with label name' do it 'returns cross reference with label name' do
expect(label.to_reference(project, format: :name)) expect(label.to_reference(project, format: :name))
.to eq %(#{label.project.path_with_namespace}~"#{label.name}") .to eq %Q(#{label.project.path_with_namespace}~"#{label.name}")
end end
end end
context 'using id' do context 'using id' do
it 'returns cross reference with label id' do it 'returns cross reference with label id' do
expect(label.to_reference(project, format: :id)) expect(label.to_reference(project, format: :id))
.to eq %(#{label.project.path_with_namespace}~#{label.id}) .to eq %Q(#{label.project.path_with_namespace}~#{label.id})
end end
end end
end end
......
...@@ -181,7 +181,7 @@ describe BambooService, models: true, caching: true do ...@@ -181,7 +181,7 @@ describe BambooService, models: true, caching: true do
end end
it 'sets commit status to "pending" when response has no results' do it 'sets commit status to "pending" when response has no results' do
stub_request(body: %({"results":{"results":{"size":"0"}}})) stub_request(body: %q({"results":{"results":{"size":"0"}}}))
is_expected.to eq('pending') is_expected.to eq('pending')
end end
...@@ -223,6 +223,6 @@ describe BambooService, models: true, caching: true do ...@@ -223,6 +223,6 @@ describe BambooService, models: true, caching: true do
end end
def bamboo_response(result_key: 42, build_state: 'success', size: 1) def bamboo_response(result_key: 42, build_state: 'success', size: 1)
%({"results":{"results":{"size":"#{size}","result":{"buildState":"#{build_state}","planResultKey":{"key":"#{result_key}"}}}}}) %Q({"results":{"results":{"size":"#{size}","result":{"buildState":"#{build_state}","planResultKey":{"key":"#{result_key}"}}}}})
end end
end end
...@@ -92,7 +92,7 @@ describe BuildkiteService, models: true, caching: true do ...@@ -92,7 +92,7 @@ describe BuildkiteService, models: true, caching: true do
end end
it 'passes through build status untouched when status is 200' do it 'passes through build status untouched when status is 200' do
stub_request(body: %({"status":"Great Success"})) stub_request(body: %q({"status":"Great Success"}))
is_expected.to eq('Great Success') is_expected.to eq('Great Success')
end end
...@@ -101,7 +101,7 @@ describe BuildkiteService, models: true, caching: true do ...@@ -101,7 +101,7 @@ describe BuildkiteService, models: true, caching: true do
end end
def stub_request(status: 200, body: nil) def stub_request(status: 200, body: nil)
body ||= %({"status":"success"}) body ||= %q({"status":"success"})
buildkite_full_url = 'https://gitlab.buildkite.com/status/secret-sauce-status-token.json?commit=123' buildkite_full_url = 'https://gitlab.buildkite.com/status/secret-sauce-status-token.json?commit=123'
WebMock.stub_request(:get, buildkite_full_url).to_return( WebMock.stub_request(:get, buildkite_full_url).to_return(
......
...@@ -50,7 +50,7 @@ describe DroneCiService, models: true, caching: true do ...@@ -50,7 +50,7 @@ describe DroneCiService, models: true, caching: true do
end end
def stub_request(status: 200, body: nil) def stub_request(status: 200, body: nil)
body ||= %({"status":"success"}) body ||= %q({"status":"success"})
WebMock.stub_request(:get, commit_status_path).to_return( WebMock.stub_request(:get, commit_status_path).to_return(
status: status, status: status,
...@@ -102,7 +102,7 @@ describe DroneCiService, models: true, caching: true do ...@@ -102,7 +102,7 @@ describe DroneCiService, models: true, caching: true do
"success" => "success" "success" => "success"
}.each do |drone_status, our_status| }.each do |drone_status, our_status|
it "sets commit status to #{our_status.inspect} when returned status is #{drone_status.inspect}" do it "sets commit status to #{our_status.inspect} when returned status is #{drone_status.inspect}" do
stub_request(body: %({"status":"#{drone_status}"})) stub_request(body: %Q({"status":"#{drone_status}"}))
is_expected.to eq(our_status) is_expected.to eq(our_status)
end end
......
...@@ -143,7 +143,7 @@ describe TeamcityService, models: true, caching: true do ...@@ -143,7 +143,7 @@ describe TeamcityService, models: true, caching: true do
end end
it 'returns a build URL when teamcity_url has no trailing slash' do it 'returns a build URL when teamcity_url has no trailing slash' do
stub_request(body: %({"build":{"id":"666"}})) stub_request(body: %q({"build":{"id":"666"}}))
is_expected.to eq('http://gitlab.com/teamcity/viewLog.html?buildId=666&buildTypeId=foo') is_expected.to eq('http://gitlab.com/teamcity/viewLog.html?buildId=666&buildTypeId=foo')
end end
...@@ -152,7 +152,7 @@ describe TeamcityService, models: true, caching: true do ...@@ -152,7 +152,7 @@ describe TeamcityService, models: true, caching: true do
let(:teamcity_url) { 'http://gitlab.com/teamcity/' } let(:teamcity_url) { 'http://gitlab.com/teamcity/' }
it 'returns a build URL' do it 'returns a build URL' do
stub_request(body: %({"build":{"id":"666"}})) stub_request(body: %q({"build":{"id":"666"}}))
is_expected.to eq('http://gitlab.com/teamcity/viewLog.html?buildId=666&buildTypeId=foo') is_expected.to eq('http://gitlab.com/teamcity/viewLog.html?buildId=666&buildTypeId=foo')
end end
...@@ -202,7 +202,7 @@ describe TeamcityService, models: true, caching: true do ...@@ -202,7 +202,7 @@ describe TeamcityService, models: true, caching: true do
def stub_request(status: 200, body: nil, build_status: 'success') def stub_request(status: 200, body: nil, build_status: 'success')
teamcity_full_url = 'http://mic:password@gitlab.com/teamcity/httpAuth/app/rest/builds/branch:unspecified:any,number:123' teamcity_full_url = 'http://mic:password@gitlab.com/teamcity/httpAuth/app/rest/builds/branch:unspecified:any,number:123'
body ||= %({"build":{"status":"#{build_status}","id":"666"}}) body ||= %Q({"build":{"status":"#{build_status}","id":"666"}})
WebMock.stub_request(:get, teamcity_full_url).to_return( WebMock.stub_request(:get, teamcity_full_url).to_return(
status: status, status: status,
......
...@@ -20,7 +20,7 @@ describe RepositoryImportWorker do ...@@ -20,7 +20,7 @@ describe RepositoryImportWorker do
context 'when the import has failed' do context 'when the import has failed' do
it 'hide the credentials that were used in the import URL' do it 'hide the credentials that were used in the import URL' do
error = %{remote: Not Found fatal: repository 'https://user:pass@test.com/root/repoC.git/' not found } error = %q{remote: Not Found fatal: repository 'https://user:pass@test.com/root/repoC.git/' not found }
expect_any_instance_of(Projects::ImportService).to receive(:execute) expect_any_instance_of(Projects::ImportService).to receive(:execute)
.and_return({ status: :error, message: error }) .and_return({ status: :error, message: error })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment