Commit 34968253 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'lib/gitlab/git' into 'master'

Enable frozen string for spec/lib/gitlab/git

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