docbrown/spec/serializers/search/podcast_episode_serializer_spec.rb
Molly Struve 82526989fc
Index Articles and Podcast Episodes to Elasticsearch (#6488) [deploy]
* Index Articles and PodcastEpisodes to Elasticsearch

* add callbacks to podcast episodes and specs

* refactor and clean up serializers
2020-03-06 16:39:36 -05:00

14 lines
568 B
Ruby

require "rails_helper"
RSpec.describe Search::PodcastEpisodeSerializer do
let(:user) { create(:user) }
let(:podcast) { create(:podcast, creator_id: user.id) }
let(:podcast_ep) { create(:podcast_episode, podcast: podcast) }
it "serializes a podcast episode" do
data_hash = described_class.new(podcast_ep).serializable_hash.dig(:data, :attributes)
user_data = Search::NestedUserSerializer.new(user).serializable_hash.dig(:data, :attributes)
expect(data_hash[:user]).to eq(user_data)
expect(data_hash.keys).to include(:id, :body_text)
end
end