Skip to content
Snippets Groups Projects
Commit baafd8de authored by Douwe Maan's avatar Douwe Maan
Browse files

Enable Style/BarePercentLiterals

parent d78513cb
No related branches found
No related tags found
No related merge requests found
Showing with 28 additions and 28 deletions
Loading
Loading
@@ -20,7 +20,7 @@ describe Banzai::Pipeline::FullPipeline do
end
 
it 'escapes the data-original attribute on a reference' do
markdown = %Q{[">bad things](#{issue.to_reference})}
markdown = %{[">bad things](#{issue.to_reference})}
result = described_class.to_html(markdown, project: project)
expect(result).to include(%{data-original='\">bad things'})
end
Loading
Loading
Loading
Loading
@@ -22,19 +22,19 @@ describe Gitlab::Diff::Highlight, lib: true do
end
 
it 'highlights and marks unchanged lines' do
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}
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}
 
expect(subject[2].text).to eq(code)
end
 
it 'highlights and marks removed lines' do
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}
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}
 
expect(subject[4].text).to eq(code)
end
 
it 'highlights and marks added lines' do
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}
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}
 
expect(subject[5].text).to eq(code)
end
Loading
Loading
@@ -53,21 +53,21 @@ describe Gitlab::Diff::Highlight, lib: true do
end
 
it 'marks unchanged lines' do
code = %Q{ def popen(cmd, path=nil)}
code = %{ def popen(cmd, path=nil)}
 
expect(subject[2].text).to eq(code)
expect(subject[2].text).not_to be_html_safe
end
 
it 'marks removed lines' do
code = %Q{- raise "System commands must be given as an array of strings"}
code = %{- raise "System commands must be given as an array of strings"}
 
expect(subject[4].text).to eq(code)
expect(subject[4].text).not_to be_html_safe
end
 
it 'marks added lines' do
code = %Q{+ raise <span class='idiff left right'>RuntimeError, </span>&quot;System commands must be given as an array of strings&quot;}
code = %{+ 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 be_html_safe
Loading
Loading
Loading
Loading
@@ -68,12 +68,12 @@ describe Gitlab::Gfm::ReferenceRewriter do
 
context 'label referenced by id' do
let(:text) { '#1 and ~123' }
it { is_expected.to eq %Q{#{project_ref}#1 and #{project_ref}~123} }
it { is_expected.to eq %{#{project_ref}#1 and #{project_ref}~123} }
end
 
context 'label referenced by text' do
let(:text) { '#1 and ~"test"' }
it { is_expected.to eq %Q{#{project_ref}#1 and #{project_ref}~123} }
it { is_expected.to eq %{#{project_ref}#1 and #{project_ref}~123} }
end
end
 
Loading
Loading
@@ -88,12 +88,12 @@ describe Gitlab::Gfm::ReferenceRewriter do
 
context 'label referenced by id' do
let(:text) { '#1 and ~321' }
it { is_expected.to eq %Q{#{project_ref}#1 and #{project_ref}~321} }
it { is_expected.to eq %{#{project_ref}#1 and #{project_ref}~321} }
end
 
context 'label referenced by text' do
let(:text) { '#1 and ~"group label"' }
it { is_expected.to eq %Q{#{project_ref}#1 and #{project_ref}~321} }
it { is_expected.to eq %{#{project_ref}#1 and #{project_ref}~321} }
end
end
end
Loading
Loading
Loading
Loading
@@ -13,9 +13,9 @@ describe Gitlab::Highlight, lib: true do
end
 
it 'highlights all the lines properly' do
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(%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(%Q{<span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>\n})
expect(lines[4]).to eq(%{<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[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})
end
 
describe 'with CRLF' do
Loading
Loading
Loading
Loading
@@ -29,7 +29,7 @@ describe Gitlab::ReferenceExtractor, lib: true do
project.team << [@u_foo, :reporter]
project.team << [@u_bar, :guest]
 
subject.analyze(%Q{
subject.analyze(%{
Inline code: `@foo`
 
Code block:
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@ describe Gitlab::UrlSanitizer, lib: true do
describe '.sanitize' do
def sanitize_url(url)
# We want to try with multi-line content because is how error messages are formatted
described_class.sanitize(%Q{
described_class.sanitize(%{
remote: Not Found
fatal: repository '#{url}' not found
})
Loading
Loading
Loading
Loading
@@ -105,14 +105,14 @@ describe ProjectLabel, models: true do
context 'using name' do
it 'returns cross reference with label name' do
expect(label.to_reference(project, format: :name)).
to eq %Q(#{label.project.path_with_namespace}~"#{label.name}")
to eq %(#{label.project.path_with_namespace}~"#{label.name}")
end
end
 
context 'using id' do
it 'returns cross reference with label id' do
expect(label.to_reference(project, format: :id)).
to eq %Q(#{label.project.path_with_namespace}~#{label.id})
to eq %(#{label.project.path_with_namespace}~#{label.id})
end
end
end
Loading
Loading
Loading
Loading
@@ -181,7 +181,7 @@ describe BambooService, models: true, caching: true do
end
 
it 'sets commit status to "pending" when response has no results' do
stub_request(body: %Q({"results":{"results":{"size":"0"}}}))
stub_request(body: %({"results":{"results":{"size":"0"}}}))
 
is_expected.to eq('pending')
end
Loading
Loading
@@ -223,6 +223,6 @@ describe BambooService, models: true, caching: true do
end
 
def bamboo_response(result_key: 42, build_state: 'success', size: 1)
%Q({"results":{"results":{"size":"#{size}","result":{"buildState":"#{build_state}","planResultKey":{"key":"#{result_key}"}}}}})
%({"results":{"results":{"size":"#{size}","result":{"buildState":"#{build_state}","planResultKey":{"key":"#{result_key}"}}}}})
end
end
Loading
Loading
@@ -92,7 +92,7 @@ describe BuildkiteService, models: true, caching: true do
end
 
it 'passes through build status untouched when status is 200' do
stub_request(body: %Q({"status":"Great Success"}))
stub_request(body: %({"status":"Great Success"}))
 
is_expected.to eq('Great Success')
end
Loading
Loading
@@ -101,7 +101,7 @@ describe BuildkiteService, models: true, caching: true do
end
 
def stub_request(status: 200, body: nil)
body ||= %Q({"status":"success"})
body ||= %({"status":"success"})
buildkite_full_url = 'https://gitlab.buildkite.com/status/secret-sauce-status-token.json?commit=123'
 
WebMock.stub_request(:get, buildkite_full_url).to_return(
Loading
Loading
Loading
Loading
@@ -50,7 +50,7 @@ describe DroneCiService, models: true, caching: true do
end
 
def stub_request(status: 200, body: nil)
body ||= %Q({"status":"success"})
body ||= %({"status":"success"})
 
WebMock.stub_request(:get, commit_status_path).to_return(
status: status,
Loading
Loading
@@ -102,7 +102,7 @@ describe DroneCiService, models: true, caching: true do
}.each do |drone_status, our_status|
 
it "sets commit status to #{our_status.inspect} when returned status is #{drone_status.inspect}" do
stub_request(body: %Q({"status":"#{drone_status}"}))
stub_request(body: %({"status":"#{drone_status}"}))
 
is_expected.to eq(our_status)
end
Loading
Loading
Loading
Loading
@@ -143,7 +143,7 @@ describe TeamcityService, models: true, caching: true do
end
 
it 'returns a build URL when teamcity_url has no trailing slash' do
stub_request(body: %Q({"build":{"id":"666"}}))
stub_request(body: %({"build":{"id":"666"}}))
 
is_expected.to eq('http://gitlab.com/teamcity/viewLog.html?buildId=666&buildTypeId=foo')
end
Loading
Loading
@@ -152,7 +152,7 @@ describe TeamcityService, models: true, caching: true do
let(:teamcity_url) { 'http://gitlab.com/teamcity/' }
 
it 'returns a build URL' do
stub_request(body: %Q({"build":{"id":"666"}}))
stub_request(body: %({"build":{"id":"666"}}))
 
is_expected.to eq('http://gitlab.com/teamcity/viewLog.html?buildId=666&buildTypeId=foo')
end
Loading
Loading
@@ -202,7 +202,7 @@ describe TeamcityService, models: true, caching: true do
 
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'
body ||= %Q({"build":{"status":"#{build_status}","id":"666"}})
body ||= %({"build":{"status":"#{build_status}","id":"666"}})
 
WebMock.stub_request(:get, teamcity_full_url).to_return(
status: status,
Loading
Loading
Loading
Loading
@@ -20,7 +20,7 @@ describe RepositoryImportWorker do
 
context 'when the import has failed' do
it 'hide the credentials that were used in the import URL' do
error = %Q{remote: Not Found fatal: repository 'https://user:pass@test.com/root/repoC.git/' not found }
error = %{remote: Not Found fatal: repository 'https://user:pass@test.com/root/repoC.git/' not found }
expect_any_instance_of(Projects::ImportService).to receive(:execute).
and_return({ status: :error, message: error })
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment