@@ -0,0 +1,31 | |||
|
1 | # Redmine - project management software | |
|
2 | # Copyright (C) 2006-2013 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
18 | require File.expand_path('../../test_helper', __FILE__) | |
|
19 | ||
|
20 | class FeedsTest < ActionController::IntegrationTest | |
|
21 | fixtures :projects, :trackers, :issue_statuses, :issues, | |
|
22 | :enumerations, :users, :issue_categories, | |
|
23 | :projects_trackers, :enabled_modules, | |
|
24 | :roles, :member_roles, :members | |
|
25 | ||
|
26 | def test_feeds_should_include_icon_tag | |
|
27 | get '/projects.atom' | |
|
28 | assert_response :success | |
|
29 | assert_select 'feed>icon', :text => %r{^http://www.example.com/favicon.ico} | |
|
30 | end | |
|
31 | end |
@@ -1,31 +1,32 | |||
|
1 | 1 | xml.instruct! |
|
2 | 2 | xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do |
|
3 | 3 | xml.title truncate_single_line(@title, :length => 100) |
|
4 | 4 | xml.link "rel" => "self", "href" => url_for(params.merge(:only_path => false)) |
|
5 | 5 | xml.link "rel" => "alternate", "href" => url_for(params.merge(:only_path => false, :format => nil, :key => nil)) |
|
6 | 6 | xml.id url_for(:controller => 'welcome', :only_path => false) |
|
7 | xml.icon favicon_url | |
|
7 | 8 | xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema) |
|
8 | 9 | xml.author { xml.name "#{Setting.app_title}" } |
|
9 | 10 | xml.generator(:uri => Redmine::Info.url) { xml.text! Redmine::Info.app_name; } |
|
10 | 11 | @items.each do |item| |
|
11 | 12 | xml.entry do |
|
12 | 13 | url = url_for(item.event_url(:only_path => false)) |
|
13 | 14 | if @project |
|
14 | 15 | xml.title truncate_single_line(item.event_title, :length => 100) |
|
15 | 16 | else |
|
16 | 17 | xml.title truncate_single_line("#{item.project} - #{item.event_title}", :length => 100) |
|
17 | 18 | end |
|
18 | 19 | xml.link "rel" => "alternate", "href" => url |
|
19 | 20 | xml.id url |
|
20 | 21 | xml.updated item.event_datetime.xmlschema |
|
21 | 22 | author = item.event_author if item.respond_to?(:event_author) |
|
22 | 23 | xml.author do |
|
23 | 24 | xml.name(author) |
|
24 | 25 | xml.email(author.mail) if author.is_a?(User) && !author.mail.blank? && !author.pref.hide_mail |
|
25 | 26 | end if author |
|
26 | 27 | xml.content "type" => "html" do |
|
27 | 28 | xml.text! textilizable(item, :event_description, :only_path => false) |
|
28 | 29 | end |
|
29 | 30 | end |
|
30 | 31 | end |
|
31 | 32 | end |
@@ -1,30 +1,31 | |||
|
1 | 1 | xml.instruct! |
|
2 | 2 | xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do |
|
3 | 3 | xml.title @title |
|
4 | 4 | xml.link "rel" => "self", "href" => url_for(:format => 'atom', :key => User.current.rss_key, :only_path => false) |
|
5 | 5 | xml.link "rel" => "alternate", "href" => home_url(:only_path => false) |
|
6 | 6 | xml.id url_for(:controller => 'welcome', :only_path => false) |
|
7 | xml.icon favicon_url | |
|
7 | 8 | xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema) |
|
8 | 9 | xml.author { xml.name "#{Setting.app_title}" } |
|
9 | 10 | @journals.each do |change| |
|
10 | 11 | issue = change.issue |
|
11 | 12 | xml.entry do |
|
12 | 13 | xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}" |
|
13 | 14 | xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false) |
|
14 | 15 | xml.id url_for(:controller => 'issues' , :action => 'show', :id => issue, :journal_id => change, :only_path => false) |
|
15 | 16 | xml.updated change.created_on.xmlschema |
|
16 | 17 | xml.author do |
|
17 | 18 | xml.name change.user.name |
|
18 | 19 | xml.email(change.user.mail) if change.user.is_a?(User) && !change.user.mail.blank? && !change.user.pref.hide_mail |
|
19 | 20 | end |
|
20 | 21 | xml.content "type" => "html" do |
|
21 | 22 | xml.text! '<ul>' |
|
22 | 23 | details_to_strings(change.details, false).each do |string| |
|
23 | 24 | xml.text! '<li>' + string + '</li>' |
|
24 | 25 | end |
|
25 | 26 | xml.text! '</ul>' |
|
26 | 27 | xml.text! textilizable(change, :notes, :only_path => false) unless change.notes.blank? |
|
27 | 28 | end |
|
28 | 29 | end |
|
29 | 30 | end |
|
30 | 31 | end |
General Comments 0
You need to be logged in to leave comments.
Login now