diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-10-09 09:14:38 +0100 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-10-09 09:14:38 +0100 |
commit | b6ab735ad2e596007d8dc0123bf5e2e018e99df8 (patch) | |
tree | 479d0fb7097caeeb132558b333cd2b8666118362 /spec/models/namespace_spec.rb | |
parent | fe5fe5242f67a7d91ff43659978892d507b71014 (diff) | |
parent | f45bb52af643cd271d415317f40b5541b18ec634 (diff) | |
download | gitlab-ce-38869-commitslist.tar.gz |
Merge branch 'master' into 38869-commitslist38869-commitslist
* master: (83 commits)
Move cycle analytics banner into a vue file
Remove executable permissions on images to make docs lint happy
Sync up hard coded DN class in migration
Redefine `respond_to?` in light of `method_missing`
Make internal methods private
Leave bad DNs alone instead of raising errors
Refactor DN error classes
Add changelog entry for LDAP normalization
Add migration specs
Move migration to background
Update DN class in migration
Normalize values, reusing DN normalization code
Remove telephoneNumber format comment
Fix space stripping
Rename method to `to_normalized_s`
Refactor initialize method for clarity
Move downcasing to normalize method
Normalize existing persisted DNs
Resolve Rubocop offenses
Switch to new DN class
...
Diffstat (limited to 'spec/models/namespace_spec.rb')
-rw-r--r-- | spec/models/namespace_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 3ea614776ca..2ebf6acd42a 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' describe Namespace do + include ProjectForksHelper + let!(:namespace) { create(:namespace) } describe 'associations' do @@ -520,4 +522,25 @@ describe Namespace do end end end + + describe '#has_forks_of?' do + let(:project) { create(:project, :public) } + let!(:forked_project) { fork_project(project, namespace.owner, namespace: namespace) } + + before do + # Reset the fork network relation + project.reload + end + + it 'knows if there is a direct fork in the namespace' do + expect(namespace.find_fork_of(project)).to eq(forked_project) + end + + it 'knows when there is as fork-of-fork in the namespace' do + other_namespace = create(:namespace) + other_fork = fork_project(forked_project, other_namespace.owner, namespace: other_namespace) + + expect(other_namespace.find_fork_of(project)).to eq(other_fork) + end + end end |