summaryrefslogtreecommitdiff
path: root/spec/serializers/entity_request_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-28 14:32:07 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-11-02 14:26:57 +0100
commitacfe394018df50bfc08aa9e41265231747675646 (patch)
tree776b34a9f27c149d8863775f760036b2484ed866 /spec/serializers/entity_request_spec.rb
parent2023511753d75545aa76968a2991dc962f7a99db (diff)
downloadgitlab-ce-acfe394018df50bfc08aa9e41265231747675646.tar.gz
Add PoC for resource serializers
Diffstat (limited to 'spec/serializers/entity_request_spec.rb')
-rw-r--r--spec/serializers/entity_request_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/serializers/entity_request_spec.rb b/spec/serializers/entity_request_spec.rb
new file mode 100644
index 00000000000..1c220a7b95d
--- /dev/null
+++ b/spec/serializers/entity_request_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+describe EntityRequest do
+ subject do
+ described_class.new(user: 'user', project: 'some project')
+ end
+
+ describe 'methods created' do
+ it 'defines accessible attributes' do
+ expect(subject.user).to eq 'user'
+ expect(subject.project).to eq 'some project'
+ end
+
+ it 'raises error when attribute is not defined' do
+ expect { subject.some_method }.to raise_error NoMethodError
+ end
+ end
+
+ describe '#merge!' do
+ before { subject.merge!(build: 'some build') }
+
+ it 'appends parameters' do
+ expect(subject.build).to eq 'some build'
+ end
+ end
+end