debian-mirror-gitlab/spec/lib/gitlab/git/bundle_file_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
748 B
Ruby
Raw Normal View History

2020-01-01 13:55:28 +05:30
# frozen_string_literal: true
2019-01-20 21:35:32 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::Git::BundleFile do
2019-01-20 21:35:32 +05:30
describe '.check!' do
let(:valid_bundle) { Tempfile.new }
let(:valid_bundle_path) { valid_bundle.path }
let(:invalid_bundle_path) { Rails.root.join('spec/fixtures/malicious.bundle') }
after do
valid_bundle.close!
end
it 'returns nil for a valid bundle' do
valid_bundle.write("# v2 git bundle\nfoo bar baz\n")
valid_bundle.close
expect(described_class.check!(valid_bundle_path)).to be_nil
end
it 'raises an exception for an invalid bundle' do
expect do
described_class.check!(invalid_bundle_path)
end.to raise_error(described_class::InvalidBundleError)
end
end
end