Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ GEM
bcrypt (3.1.22)
bigdecimal (4.1.2)
bindex (0.8.1)
bootsnap (1.24.6)
msgpack (~> 1.2)
bootsnap (1.25.0)
msgpack (~> 1.5)
brakeman (8.0.5)
racc
builder (3.3.0)
Expand Down Expand Up @@ -131,7 +131,7 @@ GEM
railties (>= 6.1)
drb (2.2.3)
dumb_delegator (1.1.0)
erb (6.0.6)
erb (6.0.7)
erubi (1.13.1)
et-orbi (1.4.1)
tzinfo
Expand Down Expand Up @@ -170,7 +170,7 @@ GEM
multi_xml (>= 0.5.2)
i18n (1.15.2)
concurrent-ruby (~> 1.0)
io-console (0.8.2)
io-console (0.9.1)
irb (1.18.0)
pp (>= 0.6.0)
prism (>= 1.3.0)
Expand Down Expand Up @@ -299,7 +299,7 @@ GEM
readline (0.0.4)
reline
regexp_parser (2.12.0)
reline (0.6.3)
reline (0.7.0)
io-console (~> 0.5)
rexml (3.4.4)
rspec (3.13.2)
Expand All @@ -325,7 +325,7 @@ GEM
rspec-support (3.13.7)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.88.2)
rubocop (1.89.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
Expand Down Expand Up @@ -427,7 +427,7 @@ GEM
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
will_paginate (4.0.1)
with_model (2.3.0)
with_model (2.3.1)
activerecord (>= 7.2)
xpath (3.2.0)
nokogiri (~> 1.8)
Expand Down
10 changes: 7 additions & 3 deletions spec/support/generate_xml.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

module GenerateXml
ITUNES_NAMESPACE = "http://www.itunes.com/dtds/podcast-1.0.dtd"

class << self
def call(feed, items)
build_feed(feed, items).to_xml
Expand All @@ -26,13 +28,15 @@ def rss_attributes(items)
"xmlns:content" => "http://purl.org/rss/1.0/modules/content/"
}

if items.any? { |item| item.try(:enclosure_url) }
attributes["xmlns:itunes"] = "http://www.itunes.com/dtds/podcast-1.0.dtd"
end
attributes["xmlns:itunes"] = ITUNES_NAMESPACE if enclosures?(items)

attributes
end

def enclosures?(items)
items.any? { |item| item.try(:enclosure_url) }
end

def build_item(xml, item)
xml.item do
xml.title(item.title)
Expand Down
Loading