docbrown/spec/labor/podcast_feed_spec.rb
2018-10-03 13:00:09 -04:00

25 lines
618 B
Ruby

require "rails_helper"
vcr_option = {
cassette_name: "se_daily_rss_feed",
allow_playback_repeats: "true"
}
RSpec.describe PodcastFeed, vcr: vcr_option do
let(:feed_url) { "http://softwareengineeringdaily.com/feed/podcast/" }
let(:podcast) { create(:podcast, feed_url: feed_url) }
before do
podcast
end
it "fetches podcast episodes" do
PodcastFeed.new.get_episodes(podcast, 2)
expect(PodcastEpisode.all.size).to eq(2)
end
it "does not refetch already fetched episodes" do
2.times { PodcastFeed.new.get_episodes(podcast, 2) }
expect(PodcastEpisode.all.size).to eq(2)
end
end