Welcome to mirror list, hosted at ThFree Co, Russian Federation.

attributes_at_ref_parser_spec.rb « git « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 96cd70b4ff1f12bdc9c98ea790384e73c059a680 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Git::AttributesAtRefParser, :seed_helper do
  let(:project) { create(:project, :repository) }
  let(:repository) { project.repository }

  subject { described_class.new(repository, 'lfs') }

  it 'loads .gitattributes blob' do
    repository.raw # Initialize repository in advance since this also checks attributes

    expected_filter = 'filter=lfs diff=lfs merge=lfs'
    receive_blob = receive(:new).with(a_string_including(expected_filter))
    expect(Gitlab::Git::AttributesParser).to receive_blob.and_call_original

    subject
  end

  it 'handles missing blobs' do
    expect { described_class.new(repository, 'non-existent-branch') }.not_to raise_error
  end

  describe '#attributes' do
    it 'returns the attributes as a Hash' do
      expect(subject.attributes('test.lfs')['filter']).to eq('lfs')
    end
  end
end