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