summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-02-28 21:14:25 +0100
committerKamil Trzciński <ayufan@ayufan.eu>2018-02-28 21:14:25 +0100
commit79a5e7fb539dc6df7de590efb69fb9ab9d4614eb (patch)
tree951e2f3194c4b4d5488864791a9a94afe7122280 /spec/serializers
parent729391fbfce4dea58478b65c684a24a1bfd125a2 (diff)
parent7e424eb852716495073881710e8a8851b4a4cd5a (diff)
downloadgitlab-ce-79a5e7fb539dc6df7de590efb69fb9ab9d4614eb.tar.gz
Merge commit '7e424eb852716495073881710e8a8851b4a4cd5a' into object-storage-ee-to-ce-backport
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/group_variable_entity_spec.rb14
-rw-r--r--spec/serializers/lfs_file_lock_entity_spec.rb19
-rw-r--r--spec/serializers/variable_entity_spec.rb14
3 files changed, 47 insertions, 0 deletions
diff --git a/spec/serializers/group_variable_entity_spec.rb b/spec/serializers/group_variable_entity_spec.rb
new file mode 100644
index 00000000000..f6de7d01f98
--- /dev/null
+++ b/spec/serializers/group_variable_entity_spec.rb
@@ -0,0 +1,14 @@
+require 'spec_helper'
+
+describe GroupVariableEntity do
+ let(:variable) { create(:ci_group_variable) }
+ let(:entity) { described_class.new(variable) }
+
+ describe '#as_json' do
+ subject { entity.as_json }
+
+ it 'contains required fields' do
+ expect(subject).to include(:id, :key, :value, :protected)
+ end
+ end
+end
diff --git a/spec/serializers/lfs_file_lock_entity_spec.rb b/spec/serializers/lfs_file_lock_entity_spec.rb
new file mode 100644
index 00000000000..5919f473a90
--- /dev/null
+++ b/spec/serializers/lfs_file_lock_entity_spec.rb
@@ -0,0 +1,19 @@
+require 'spec_helper'
+
+describe LfsFileLockEntity do
+ let(:user) { create(:user) }
+ let(:resource) { create(:lfs_file_lock, user: user) }
+
+ let(:request) { double('request', current_user: user) }
+
+ subject { described_class.new(resource, request: request).as_json }
+
+ it 'exposes basic attrs of the lock' do
+ expect(subject).to include(:id, :path, :locked_at)
+ end
+
+ it 'exposes the owner info' do
+ expect(subject).to include(:owner)
+ expect(subject[:owner][:name]).to eq(user.name)
+ end
+end
diff --git a/spec/serializers/variable_entity_spec.rb b/spec/serializers/variable_entity_spec.rb
new file mode 100644
index 00000000000..effc0022633
--- /dev/null
+++ b/spec/serializers/variable_entity_spec.rb
@@ -0,0 +1,14 @@
+require 'spec_helper'
+
+describe VariableEntity do
+ let(:variable) { create(:ci_variable) }
+ let(:entity) { described_class.new(variable) }
+
+ describe '#as_json' do
+ subject { entity.as_json }
+
+ it 'contains required fields' do
+ expect(subject).to include(:id, :key, :value, :protected)
+ end
+ end
+end