diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2019-04-16 19:16:52 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-04-19 03:00:48 +0300 |
commit | 1dd4a007804fa0e6ea00a00805d08808f6c0be3a (patch) | |
tree | 09a6b2520dfea63090b3375f02f36724639951e2 /spec/models | |
parent | 86be4a6f466205b415de74330dd495a2e8b3c9d0 (diff) |
Adds namespace information to project endpoint
- Namespace now return avatar_url and web_url
- NamespaceBasic entity was modified to include avatar_url and web_url,
information is fetched differently depending if the Namespace is a user
or a group
Includes documentation changes
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/39858
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/namespace_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 387d1221c76..95a4b0f6d71 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -63,6 +63,11 @@ describe Namespace do end end + describe 'delegate' do + it { is_expected.to delegate_method(:name).to(:owner).with_prefix.with_arguments(allow_nil: true) } + it { is_expected.to delegate_method(:avatar_url).to(:owner).with_arguments(allow_nil: true) } + end + describe "Respond to" do it { is_expected.to respond_to(:human_name) } it { is_expected.to respond_to(:to_param) } @@ -801,4 +806,21 @@ describe Namespace do end end end + + describe '#user?' do + subject { namespace.user? } + + context 'when type is a user' do + let(:user) { create(:user) } + let(:namespace) { user.namespace } + + it { is_expected.to be_truthy } + end + + context 'when type is a group' do + let(:namespace) { create(:group) } + + it { is_expected.to be_falsy } + end + end end |