summaryrefslogtreecommitdiff
path: root/spec/models/namespace_spec.rb
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2019-04-16 11:16:52 -0500
committerMayra Cabrera <mcabrera@gitlab.com>2019-04-18 19:00:48 -0500
commit1dd4a007804fa0e6ea00a00805d08808f6c0be3a (patch)
tree09a6b2520dfea63090b3375f02f36724639951e2 /spec/models/namespace_spec.rb
parent86be4a6f466205b415de74330dd495a2e8b3c9d0 (diff)
downloadgitlab-ce-1dd4a007804fa0e6ea00a00805d08808f6c0be3a.tar.gz
Adds namespace information to project endpoint39858-add-group-owned-info-to-projects-api
- 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/namespace_spec.rb')
-rw-r--r--spec/models/namespace_spec.rb22
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