Commit 0617d613 authored by Utkarsh Gupta's avatar Utkarsh Gupta Committed by Thong Kuah

Enable frozen string for spec/lib/gitlab/git

parent f4ffffff
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::AttributesAtRefParser, :seed_helper do describe Gitlab::Git::AttributesAtRefParser, :seed_helper do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::AttributesParser, :seed_helper do describe Gitlab::Git::AttributesParser, :seed_helper do
......
# frozen_string_literal: true
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Blame, :seed_helper do describe Gitlab::Git::Blame, :seed_helper do
......
# frozen_string_literal: true
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Blob, :seed_helper do describe Gitlab::Git::Blob, :seed_helper do
......
# frozen_string_literal: true
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Branch, :seed_helper do describe Gitlab::Git::Branch, :seed_helper do
...@@ -77,7 +79,7 @@ describe Gitlab::Git::Branch, :seed_helper do ...@@ -77,7 +79,7 @@ describe Gitlab::Git::Branch, :seed_helper do
tree = parents.first.tree tree = parents.first.tree
{ {
message: 'commit message', message: +'commit message',
author: committer, author: committer,
committer: committer, committer: committer,
tree: tree, tree: tree,
...@@ -126,7 +128,7 @@ describe Gitlab::Git::Branch, :seed_helper do ...@@ -126,7 +128,7 @@ describe Gitlab::Git::Branch, :seed_helper do
it { expect(repository.branches.size).to eq(SeedRepo::Repo::BRANCHES.size) } it { expect(repository.branches.size).to eq(SeedRepo::Repo::BRANCHES.size) }
def create_commit def create_commit
params[:message].delete!("\r") params[:message].delete!(+"\r")
Rugged::Commit.create(rugged, params.merge(committer: committer.merge(time: Time.now))) Rugged::Commit.create(rugged, params.merge(committer: committer.merge(time: Time.now)))
end end
end end
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::BundleFile do describe Gitlab::Git::BundleFile do
......
# frozen_string_literal: true
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Commit, :seed_helper do describe Gitlab::Git::Commit, :seed_helper do
...@@ -64,8 +66,8 @@ describe Gitlab::Git::Commit, :seed_helper do ...@@ -64,8 +66,8 @@ describe Gitlab::Git::Commit, :seed_helper do
end end
describe "Commit info from gitaly commit" do describe "Commit info from gitaly commit" do
let(:subject) { "My commit".force_encoding('ASCII-8BIT') } let(:subject) { (+"My commit").force_encoding('ASCII-8BIT') }
let(:body) { subject + "My body".force_encoding('ASCII-8BIT') } let(:body) { subject + (+"My body").force_encoding('ASCII-8BIT') }
let(:body_size) { body.length } let(:body_size) { body.length }
let(:gitaly_commit) { build(:gitaly_commit, subject: subject, body: body, body_size: body_size) } let(:gitaly_commit) { build(:gitaly_commit, subject: subject, body: body, body_size: body_size) }
let(:id) { gitaly_commit.id } let(:id) { gitaly_commit.id }
...@@ -85,7 +87,7 @@ describe Gitlab::Git::Commit, :seed_helper do ...@@ -85,7 +87,7 @@ describe Gitlab::Git::Commit, :seed_helper do
it { expect(commit.parent_ids).to eq(gitaly_commit.parent_ids) } it { expect(commit.parent_ids).to eq(gitaly_commit.parent_ids) }
context 'body_size != body.size' do context 'body_size != body.size' do
let(:body) { "".force_encoding('ASCII-8BIT') } let(:body) { (+"").force_encoding('ASCII-8BIT') }
context 'zero body_size' do context 'zero body_size' do
it { expect(commit.safe_message).to eq(subject) } it { expect(commit.safe_message).to eq(subject) }
......
# frozen_string_literal: true
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Compare, :seed_helper do describe Gitlab::Git::Compare, :seed_helper do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::Conflict::File do describe Gitlab::Git::Conflict::File do
let(:conflict) { { theirs: { path: 'foo', mode: 33188 }, ours: { path: 'foo', mode: 33188 } } } let(:conflict) { { theirs: { path: 'foo', mode: 33188 }, ours: { path: 'foo', mode: 33188 } } }
let(:invalid_content) { described_class.new(nil, nil, conflict, "a\xC4\xFC".force_encoding(Encoding::ASCII_8BIT)) } let(:invalid_content) { described_class.new(nil, nil, conflict, (+"a\xC4\xFC").force_encoding(Encoding::ASCII_8BIT)) }
let(:valid_content) { described_class.new(nil, nil, conflict, "Espa\xC3\xB1a".force_encoding(Encoding::ASCII_8BIT)) } let(:valid_content) { described_class.new(nil, nil, conflict, (+"Espa\xC3\xB1a").force_encoding(Encoding::ASCII_8BIT)) }
describe '#lines' do describe '#lines' do
context 'when the content contains non-UTF-8 characters' do context 'when the content contains non-UTF-8 characters' do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::Conflict::Parser do describe Gitlab::Git::Conflict::Parser do
...@@ -208,7 +210,7 @@ CONFLICT ...@@ -208,7 +210,7 @@ CONFLICT
# these strings. # these strings.
context 'when the file contains UTF-8 characters' do context 'when the file contains UTF-8 characters' do
it 'does not raise' do it 'does not raise' do
expect { parse_text("Espa\xC3\xB1a".force_encoding(Encoding::ASCII_8BIT)) } expect { parse_text((+"Espa\xC3\xB1a").force_encoding(Encoding::ASCII_8BIT)) }
.not_to raise_error .not_to raise_error
end end
end end
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::DiffCollection, :seed_helper do describe Gitlab::Git::DiffCollection, :seed_helper do
......
# frozen_string_literal: true
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Diff, :seed_helper do describe Gitlab::Git::Diff, :seed_helper do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::GitmodulesParser do describe Gitlab::Git::GitmodulesParser do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::HookEnv do describe Gitlab::Git::HookEnv do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::LfsChanges do describe Gitlab::Git::LfsChanges do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::LfsPointerFile do describe Gitlab::Git::LfsPointerFile do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::PreReceiveError do describe Gitlab::Git::PreReceiveError do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::Push do describe Gitlab::Git::Push do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::RawDiffChange do describe Gitlab::Git::RawDiffChange do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::RemoteMirror do describe Gitlab::Git::RemoteMirror do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::RemoteRepository, :seed_helper do describe Gitlab::Git::RemoteRepository, :seed_helper do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::RepositoryCleaner do describe Gitlab::Git::RepositoryCleaner do
......
# frozen_string_literal: true
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Repository, :seed_helper do describe Gitlab::Git::Repository, :seed_helper do
......
# frozen_string_literal: true
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Tag, :seed_helper do describe Gitlab::Git::Tag, :seed_helper do
......
# frozen_string_literal: true
require "spec_helper" require "spec_helper"
describe Gitlab::Git::Tree, :seed_helper do describe Gitlab::Git::Tree, :seed_helper do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::User do describe Gitlab::Git::User do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::Util do describe Gitlab::Git::Util do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::Wiki do describe Gitlab::Git::Wiki do
......
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe Gitlab::Git::WrapsGitalyErrors do describe Gitlab::Git::WrapsGitalyErrors do
......
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