summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2017-11-06 20:44:38 +0900
committerShinya Maeda <shinya@gitlab.com>2017-11-06 20:44:38 +0900
commit377916ed72cf31ee31e463f395993d1ec0dc579b (patch)
tree89f2e9ce00777a8c13ef74f8e50540274c73c41c /spec/models
parenteba27fe022562e6e5cdae81a08addff6ec152826 (diff)
parentd4ceec9d47a7da5fa17cb6e161ac491e13fcb8bd (diff)
downloadgitlab-ce-377916ed72cf31ee31e463f395993d1ec0dc579b.tar.gz
Merge branch 'master' into refactor-clusters
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/environment_spec.rb1
-rw-r--r--spec/models/repository_spec.rb20
2 files changed, 20 insertions, 1 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb
index f75de0a0d88..1ce1d595c60 100644
--- a/spec/models/environment_spec.rb
+++ b/spec/models/environment_spec.rb
@@ -18,7 +18,6 @@ describe Environment do
it { is_expected.to validate_length_of(:slug).is_at_most(24) }
it { is_expected.to validate_length_of(:external_url).is_at_most(255) }
- it { is_expected.to validate_uniqueness_of(:external_url).scoped_to(:project_id) }
describe '.order_by_last_deployed_at' do
let(:project) { create(:project, :repository) }
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index d7c07676911..8a6aa767ce6 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -2298,4 +2298,24 @@ describe Repository do
project.commit_by(oid: '1' * 40)
end
end
+
+ describe '#raw_repository' do
+ subject { repository.raw_repository }
+
+ it 'returns a Gitlab::Git::Repository representation of the repository' do
+ expect(subject).to be_a(Gitlab::Git::Repository)
+ expect(subject.relative_path).to eq(project.disk_path + '.git')
+ expect(subject.gl_repository).to eq("project-#{project.id}")
+ end
+
+ context 'with a wiki repository' do
+ let(:repository) { project.wiki.repository }
+
+ it 'creates a Gitlab::Git::Repository with the proper attributes' do
+ expect(subject).to be_a(Gitlab::Git::Repository)
+ expect(subject.relative_path).to eq(project.disk_path + '.wiki.git')
+ expect(subject.gl_repository).to eq("wiki-#{project.id}")
+ end
+ end
+ end
end