debian-mirror-gitlab/spec/models/project_repository_spec.rb

29 lines
780 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe ProjectRepository do
2019-02-15 15:39:39 +05:30
describe 'associations' do
it { is_expected.to belong_to(:shard) }
it { is_expected.to belong_to(:project) }
end
2021-01-03 14:25:43 +05:30
it_behaves_like 'shardable scopes' do
let_it_be(:record_1) { create(:project_repository) }
let_it_be(:record_2, reload: true) { create(:project_repository) }
end
2019-02-15 15:39:39 +05:30
describe '.find_project' do
it 'finds project by disk path' do
project = create(:project)
project.track_project_repository
expect(described_class.find_project(project.disk_path)).to eq(project)
end
it 'returns nil when it does not find the project' do
expect(described_class.find_project('@@unexisting/path/to/project')).to be_nil
end
end
end