diff --git a/Gemfile.lock b/Gemfile.lock index 24ea95c4c..fb69f5a75 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -215,7 +215,7 @@ GEM mustermann (1.0.1) mysql2 (0.4.10) nio4r (2.1.0) - nokogiri (1.8.1) + nokogiri (1.8.2) mini_portile2 (~> 2.3.0) om (3.1.1) activemodel diff --git a/app/views/profile/index.html.erb b/app/views/profile/index.html.erb index 9bb254dc0..41e5bf440 100644 --- a/app/views/profile/index.html.erb +++ b/app/views/profile/index.html.erb @@ -1,8 +1,6 @@ <% page_title(@user.name) %> -
-

<%= @user.name %>

-
+

<%= @user.name %>

<%= t('admin.users.created') %>
@@ -14,7 +12,6 @@
<%= @user.email %>
-
<%= render partial: 'user_items', diff --git a/app/views/sitemap/collections.xml.builder b/app/views/sitemap/collections.xml.builder index a98403e97..5168af2d2 100644 --- a/app/views/sitemap/collections.xml.builder +++ b/app/views/sitemap/collections.xml.builder @@ -11,7 +11,7 @@ cache 'sitemap', expires_in: 24.hours do @collections.each do |collection| xml.url do xml.loc community_collection_url(collection.community, collection) - xml.lastmod collection.updated_at + xml.lastmod collection.updated_at.utc.iso8601 xml.changefreq 'weekly' xml.priority 1 end diff --git a/app/views/sitemap/communities.xml.builder b/app/views/sitemap/communities.xml.builder index d963535b6..ab6015e32 100644 --- a/app/views/sitemap/communities.xml.builder +++ b/app/views/sitemap/communities.xml.builder @@ -11,7 +11,7 @@ cache 'sitemap', expires_in: 24.hours do @communities.each do |community| xml.url do xml.loc community_url(community) - xml.lastmod community.updated_at + xml.lastmod community.updated_at.utc.iso8601 xml.changefreq 'weekly' xml.priority 1 end diff --git a/test/controllers/sitemap_controller_test.rb b/test/integration/sitemap_test.rb similarity index 87% rename from test/controllers/sitemap_controller_test.rb rename to test/integration/sitemap_test.rb index 74488ceb4..2d5dc0e8e 100644 --- a/test/controllers/sitemap_controller_test.rb +++ b/test/integration/sitemap_test.rb @@ -1,5 +1,4 @@ require 'test_helper' -require 'open-uri' class SitemapTest < ActionDispatch::IntegrationTest @@ -54,15 +53,13 @@ def before_all end context 'sitemap index' do - setup do - get sitemapindex_url - end should 'be valid sitemapindex xml' do + get sitemapindex_url + schema = Nokogiri::XML::Schema(File.open(file_fixture('siteindex.xsd'))) document = Nokogiri::XML(@response.body) assert_empty schema.validate(document) - end - should 'show sitemap for each of communities, collections, items and thesis' do + assert_select 'sitemap', 4 assert_select 'loc', /sitemap-items.xml/ assert_select 'loc', /sitemap-theses.xml/ @@ -72,15 +69,13 @@ def before_all end context 'items sitemap' do - setup do - get items_sitemap_url - end should 'be valid sitemap xml' do + get items_sitemap_url + schema = Nokogiri::XML::Schema(File.open(file_fixture('sitemap.xsd'))) document = Nokogiri::XML(@response.body) assert_empty schema.validate(document) - end - should 'show url, last modified date, change frequency, priority and type' do + assert_select 'url' do assert_select 'loc' assert_select 'lastmod' @@ -88,8 +83,8 @@ def before_all assert_select 'priority' assert_select 'rs|md[type=?]', 'text/html' end - end - should 'show public item attributes' do + + # show public item attributes assert_select 'loc', item_url(@item) assert_select 'lastmod', @item.updated_at.to_s @item.file_sets.first.unlock_and_fetch_ldp_object do |uo| @@ -103,59 +98,50 @@ def before_all assert_select 'rs|ln[length=?]', uo.original_file.size.to_s assert_select 'rs|ln[type=?]', uo.original_file.mime_type.to_s end - end - should 'not show private items' do + # not show private items assert_select 'url', count: 2 - assert_select 'loc', { count: 0, text: item_url(@private_item) }, 'private items shant appear in the sitemap' + assert_select 'loc', { count: 0, text: item_url(@private_item) }, 'private items should not appear in the sitemap' end end context 'collections sitemap' do - setup do - get collections_sitemap_url - end should 'be valid sitemap xml' do get collections_sitemap_url + schema = Nokogiri::XML::Schema(File.open(file_fixture('sitemap.xsd'))) document = Nokogiri::XML(@response.body) assert_empty schema.validate(document) - end - should 'show url, last modified date, change frequency and priority' do + assert_select 'url' do assert_select 'loc' assert_select 'lastmod' assert_select 'changefreq' assert_select 'priority' end - end - should 'show location and last modified' do + assert_select 'loc', community_collection_url(@collection.community, @collection) - assert_select 'lastmod', @collection.updated_at.to_s + assert_select 'lastmod', @collection.updated_at.utc.iso8601 end end context 'communities sitemap' do - setup do - get communities_sitemap_url - end should 'be valid sitemap xml' do get communities_sitemap_url + schema = Nokogiri::XML::Schema(File.open(file_fixture('sitemap.xsd'))) document = Nokogiri::XML(@response.body) assert_empty schema.validate(document) - end - should 'show url, last modified date, change frequency and priority' do + assert_select 'url' do assert_select 'loc' assert_select 'lastmod' assert_select 'changefreq' assert_select 'priority' end - end - should 'show location and last modified' do + assert_select 'loc', community_url(@community) - assert_select 'lastmod', @community.updated_at.to_s + assert_select 'lastmod', @community.updated_at.utc.iso8601 end end