add_serializer_spec.rb 640 B

123456789101112131415161718192021222324252627
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe ActivityPub::AddSerializer do
  4. describe '.serializer_for' do
  5. subject { described_class.serializer_for(model, {}) }
  6. context 'with a Status model' do
  7. let(:model) { Status.new }
  8. it { is_expected.to eq(described_class::UriSerializer) }
  9. end
  10. context 'with a FeaturedTag model' do
  11. let(:model) { FeaturedTag.new }
  12. it { is_expected.to eq(ActivityPub::HashtagSerializer) }
  13. end
  14. context 'with an Array' do
  15. let(:model) { [] }
  16. it { is_expected.to eq(ActiveModel::Serializer::CollectionSerializer) }
  17. end
  18. end
  19. end