Welcome to mirror list, hosted at ThFree Co, Russian Federation.

issue_serializer_spec.rb « serializers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 75578816e753f1ace22a98e0158b7437d637d81d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require 'spec_helper'

describe IssueSerializer do
  let(:resource) { create(:issue) }
  let(:user)     { create(:user) }
  let(:json_entity) do
    described_class.new(current_user: user)
      .represent(resource, serializer: serializer)
      .with_indifferent_access
  end

  context 'non-sidebar issue serialization' do
    let(:serializer) { nil }

    it 'matches issue json schema' do
      expect(json_entity).to match_schema('entities/issue')
    end
  end

  context 'sidebar issue serialization' do
    let(:serializer) { 'sidebar' }

    it 'matches sidebar issue json schema' do
      expect(json_entity).to match_schema('entities/issue_sidebar')
    end
  end
end