debian-mirror-gitlab/spec/serializers/ci/job_serializer_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
711 B
Ruby
Raw Permalink Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2022-01-26 12:08:38 +05:30
RSpec.describe Ci::JobSerializer do
2017-08-17 22:00:37 +05:30
let(:user) { create(:user) }
let(:serializer) do
described_class.new(current_user: user)
end
subject { serializer.represent(resource) }
describe '#represent' do
context 'when a single object is being serialized' do
let(:resource) { create(:ci_build) }
it 'serializers the pipeline object' do
expect(subject[:id]).to eq resource.id
end
end
context 'when multiple objects are being serialized' do
let(:resource) { create_list(:ci_build, 2) }
it 'serializers the array of pipelines' do
expect(subject).not_to be_empty
end
end
end
end