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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-04 18:08:40 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-04 18:08:40 +0300
commit6b833f1e0340e00fdee074da9c42c0d4e07a46d2 (patch)
tree6fc3a7a2f8a02fec8d1e7561b453d33eb4048dad /spec/models/project_spec.rb
parent88a0824944720b6edaaef56376713541b9a02118 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb136
1 files changed, 8 insertions, 128 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index df32545b90b..7decc1bc911 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -106,6 +106,14 @@ describe Project do
it { is_expected.to have_many(:sourced_pipelines) }
it { is_expected.to have_many(:source_pipelines) }
+ it_behaves_like 'model with repository' do
+ let_it_be(:container) { create(:project, :repository, path: 'somewhere') }
+ let(:stubbed_container) { build_stubbed(:project) }
+ let(:expected_full_path) { "#{container.namespace.full_path}/somewhere" }
+ let(:expected_repository_klass) { Repository }
+ let(:expected_storage_klass) { Storage::Hashed }
+ end
+
it 'has an inverse relationship with merge requests' do
expect(described_class.reflect_on_association(:merge_requests).has_inverse?).to eq(:target_project)
end
@@ -510,7 +518,6 @@ describe Project do
describe 'Respond to' do
it { is_expected.to respond_to(:url_to_repo) }
- it { is_expected.to respond_to(:repo_exists?) }
it { is_expected.to respond_to(:execute_hooks) }
it { is_expected.to respond_to(:owner) }
it { is_expected.to respond_to(:path_with_namespace) }
@@ -664,44 +671,6 @@ describe Project do
expect(project.url_to_repo).to eq(Gitlab.config.gitlab_shell.ssh_path_prefix + 'somewhere.git')
end
- describe "#web_url" do
- let(:project) { create(:project, path: "somewhere") }
-
- context 'when given the only_path option' do
- subject { project.web_url(only_path: only_path) }
-
- context 'when only_path is false' do
- let(:only_path) { false }
-
- it 'returns the full web URL for this repo' do
- expect(subject).to eq("#{Gitlab.config.gitlab.url}/#{project.namespace.full_path}/somewhere")
- end
- end
-
- context 'when only_path is true' do
- let(:only_path) { true }
-
- it 'returns the relative web URL for this repo' do
- expect(subject).to eq("/#{project.namespace.full_path}/somewhere")
- end
- end
-
- context 'when only_path is nil' do
- let(:only_path) { nil }
-
- it 'returns the full web URL for this repo' do
- expect(subject).to eq("#{Gitlab.config.gitlab.url}/#{project.namespace.full_path}/somewhere")
- end
- end
- end
-
- context 'when not given the only_path option' do
- it 'returns the full web URL for this repo' do
- expect(project.web_url).to eq("#{Gitlab.config.gitlab.url}/#{project.namespace.full_path}/somewhere")
- end
- end
- end
-
describe "#readme_url" do
context 'with a non-existing repository' do
let(:project) { create(:project) }
@@ -931,14 +900,6 @@ describe Project do
end
end
- describe '#repository' do
- let(:project) { create(:project, :repository) }
-
- it 'returns valid repo' do
- expect(project.repository).to be_kind_of(Repository)
- end
- end
-
describe '#default_issues_tracker?' do
it "is true if used internal tracker" do
project = build(:project)
@@ -954,24 +915,6 @@ describe Project do
end
end
- describe '#empty_repo?' do
- context 'when the repo does not exist' do
- let(:project) { build_stubbed(:project) }
-
- it 'returns true' do
- expect(project.empty_repo?).to be(true)
- end
- end
-
- context 'when the repo exists' do
- let(:project) { create(:project, :repository) }
- let(:empty_project) { create(:project, :empty_repo) }
-
- it { expect(empty_project.empty_repo?).to be(true) }
- it { expect(project.empty_repo?).to be(false) }
- end
- end
-
describe '#external_issue_tracker' do
let(:project) { create(:project) }
let(:ext_project) { create(:redmine_project) }
@@ -3406,59 +3349,6 @@ describe Project do
end
end
- describe '#http_url_to_repo' do
- let(:project) { create(:project) }
-
- context 'when a custom HTTP clone URL root is not set' do
- it 'returns the url to the repo without a username' do
- expect(project.http_url_to_repo).to eq("#{project.web_url}.git")
- expect(project.http_url_to_repo).not_to include('@')
- end
- end
-
- context 'when a custom HTTP clone URL root is set' do
- before do
- stub_application_setting(custom_http_clone_url_root: custom_http_clone_url_root)
- end
-
- context 'when custom HTTP clone URL root has a relative URL root' do
- context 'when custom HTTP clone URL root ends with a slash' do
- let(:custom_http_clone_url_root) { 'https://git.example.com:51234/mygitlab/' }
-
- it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(project.http_url_to_repo).to eq("https://git.example.com:51234/mygitlab/#{project.full_path}.git")
- end
- end
-
- context 'when custom HTTP clone URL root does not end with a slash' do
- let(:custom_http_clone_url_root) { 'https://git.example.com:51234/mygitlab' }
-
- it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(project.http_url_to_repo).to eq("https://git.example.com:51234/mygitlab/#{project.full_path}.git")
- end
- end
- end
-
- context 'when custom HTTP clone URL root does not have a relative URL root' do
- context 'when custom HTTP clone URL root ends with a slash' do
- let(:custom_http_clone_url_root) { 'https://git.example.com:51234/' }
-
- it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(project.http_url_to_repo).to eq("https://git.example.com:51234/#{project.full_path}.git")
- end
- end
-
- context 'when custom HTTP clone URL root does not end with a slash' do
- let(:custom_http_clone_url_root) { 'https://git.example.com:51234' }
-
- it 'returns the url to the repo, with the root replaced with the custom one' do
- expect(project.http_url_to_repo).to eq("https://git.example.com:51234/#{project.full_path}.git")
- end
- end
- end
- end
- end
-
describe '#lfs_http_url_to_repo' do
let(:project) { create(:project) }
@@ -5054,16 +4944,6 @@ describe Project do
end
end
- context '#commits_by' do
- let(:project) { create(:project, :repository) }
- let(:commits) { project.repository.commits('HEAD', limit: 3).commits }
- let(:commit_shas) { commits.map(&:id) }
-
- it 'retrieves several commits from the repository by oid' do
- expect(project.commits_by(oids: commit_shas)).to eq commits
- end
- end
-
context '#members_among' do
let(:users) { create_list(:user, 3) }