Skip to content
Open
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
1 change: 0 additions & 1 deletion app/views/dashboard/home.atom.builder
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ atom_feed do |feed|
@versions.each do |version|
feed.entry(version, url: version_url(version.to_param)) do |entry|
entry.title "#{version.project.name} - #{version.number}"
entry.published Time.at(version.published_at).rfc822
entry.content "", type: "html"
entry.author do |author|
author.name("Libraries.io")
Expand Down
1 change: 0 additions & 1 deletion app/views/projects/tags.atom.builder
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ atom_feed do |feed|
@tags.each do |tag|
feed.entry(tag, url: version_url(@project.to_param.merge(number: tag.name))) do |entry|
entry.title(tag.number)
entry.published Time.at(tag.published_at).rfc822
entry.content "", type: "html"
entry.author do |author|
author.name("Libraries.io")
Expand Down
1 change: 0 additions & 1 deletion app/views/projects/versions.atom.builder
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ atom_feed do |feed|
@versions.each do |version|
feed.entry(version, url: version_url(version.to_param)) do |entry|
entry.title(version.number)
entry.published Time.at(version.published_at).rfc822
entry.content "", type: "html"
entry.author do |author|
author.name("Libraries.io")
Expand Down
23 changes: 23 additions & 0 deletions spec/requests/projects_versions_atom_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

require "rails_helper"

RSpec.describe "Projects versions Atom feed", type: :request do
let!(:project) { create(:project, platform: "NPM", name: "example-package") }
let!(:version1) { create(:version, project: project, number: "1.0.0", published_at: 2.days.ago) }
let!(:version2) { create(:version, project: project, number: "1.1.0", published_at: 1.day.ago) }

it "renders RFC3339 <published> once per entry" do
visit project_versions_path(project.to_param.merge(format: :atom))

# Find all <published> elements
published_nodes = Nokogiri::XML(page.body).xpath("//xmlns:entry/xmlns:published")
expect(published_nodes.length).to eq(2)

# RFC3339 basic check: YYYY-MM-DDTHH:MM:SSZ
rfc3339_regex = /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z\z/
published_nodes.each do |node|
expect(node.text).to match(rfc3339_regex)
end
end
end