debian-mirror-gitlab/spec/serializers/project_serializer_spec.rb

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

46 lines
1.1 KiB
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe ProjectSerializer do
2020-04-08 14:13:33 +05:30
let_it_be(:project) { create(:project) }
2021-04-29 21:17:54 +05:30
2019-07-07 11:18:12 +05:30
let(:provider_url) { 'http://provider.com' }
context 'when serializer option is :import' do
subject do
described_class.new.represent(project, serializer: :import, provider_url: provider_url)
end
before do
allow(ProjectImportEntity).to receive(:represent)
end
it 'represents with ProjectImportEntity' do
subject
expect(ProjectImportEntity)
.to have_received(:represent)
.with(project, serializer: :import, provider_url: provider_url, request: an_instance_of(EntityRequest))
end
end
context 'when serializer option is omitted' do
subject do
described_class.new.represent(project)
end
before do
allow(ProjectEntity).to receive(:represent)
end
it 'represents with ProjectEntity' do
subject
expect(ProjectEntity)
.to have_received(:represent)
.with(project, request: an_instance_of(EntityRequest))
end
end
end