Commit 88a842e2 authored by Igor Drozdov's avatar Igor Drozdov

Squash examples in spec/lib/gitlab/git/blob_spec.rb

parent fcf2ee20
......@@ -404,7 +404,6 @@ RSpec/RepeatedExample:
- 'spec/lib/banzai/filter/autolink_filter_spec.rb'
- 'spec/lib/gitlab/closing_issue_extractor_spec.rb'
- 'spec/lib/gitlab/danger/changelog_spec.rb'
- 'spec/lib/gitlab/git/blob_spec.rb'
- 'spec/lib/gitlab/import_export/project/relation_factory_spec.rb'
- 'spec/models/ability_spec.rb'
- 'spec/models/ci/build_spec.rb'
......
......@@ -409,37 +409,43 @@ describe Gitlab::Git::Blob, :seed_helper do
end
end
describe 'encoding' do
describe 'encoding', :aggregate_failures do
context 'file with russian text' do
let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "encoding/russian.rb") }
it { expect(blob.name).to eq("russian.rb") }
it { expect(blob.data.lines.first).to eq("Хороший файл") }
it { expect(blob.size).to eq(23) }
it { expect(blob.truncated?).to be_falsey }
it 'has the correct blob attributes' do
expect(blob.name).to eq("russian.rb")
expect(blob.data.lines.first).to eq("Хороший файл")
expect(blob.size).to eq(23)
expect(blob.truncated?).to be_falsey
# Run it twice since data is encoded after the first run
it { expect(blob.truncated?).to be_falsey }
it { expect(blob.mode).to eq("100755") }
expect(blob.truncated?).to be_falsey
expect(blob.mode).to eq("100755")
end
end
context 'file with Japanese text' do
let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::Commit::ID, "encoding/テスト.txt") }
it { expect(blob.name).to eq("テスト.txt") }
it { expect(blob.data).to include("これはテスト") }
it { expect(blob.size).to eq(340) }
it { expect(blob.mode).to eq("100755") }
it { expect(blob.truncated?).to be_falsey }
it 'has the correct blob attributes' do
expect(blob.name).to eq("テスト.txt")
expect(blob.data).to include("これはテスト")
expect(blob.size).to eq(340)
expect(blob.mode).to eq("100755")
expect(blob.truncated?).to be_falsey
end
end
context 'file with ISO-8859 text' do
let(:blob) { Gitlab::Git::Blob.find(repository, SeedRepo::LastCommit::ID, "encoding/iso8859.txt") }
it { expect(blob.name).to eq("iso8859.txt") }
it { expect(blob.loaded_size).to eq(4) }
it { expect(blob.size).to eq(4) }
it { expect(blob.mode).to eq("100644") }
it { expect(blob.truncated?).to be_falsey }
it 'has the correct blob attributes' do
expect(blob.name).to eq("iso8859.txt")
expect(blob.loaded_size).to eq(4)
expect(blob.size).to eq(4)
expect(blob.mode).to eq("100644")
expect(blob.truncated?).to be_falsey
end
end
end
......
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