##// END OF EJS Templates
Fixed: no :author method error on projects atom feed (#1623)....
Jean-Philippe Lang -
r1639:b5444b5fcd84
parent child
Show More
@@ -48,7 +48,8 class Project < ActiveRecord::Base
48 acts_as_customizable
48 acts_as_customizable
49 acts_as_searchable :columns => ['name', 'description'], :project_key => 'id', :permission => nil
49 acts_as_searchable :columns => ['name', 'description'], :project_key => 'id', :permission => nil
50 acts_as_event :title => Proc.new {|o| "#{l(:label_project)}: #{o.name}"},
50 acts_as_event :title => Proc.new {|o| "#{l(:label_project)}: #{o.name}"},
51 :url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o.id}}
51 :url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o.id}},
52 :author => nil
52
53
53 attr_protected :status, :enabled_module_names
54 attr_protected :status, :enabled_module_names
54
55
@@ -42,6 +42,14 class ProjectsControllerTest < Test::Unit::TestCase
42 # Subproject in corresponding value
42 # Subproject in corresponding value
43 assert assigns(:project_tree)[Project.find(1)].include?(Project.find(3))
43 assert assigns(:project_tree)[Project.find(1)].include?(Project.find(3))
44 end
44 end
45
46 def test_index_atom
47 get :index, :format => 'atom'
48 assert_response :success
49 assert_template 'common/feed.atom.rxml'
50 assert_select 'feed>title', :text => 'Redmine: Latest projects'
51 assert_select 'feed>entry', :count => Project.count(:conditions => Project.visible_by(User.current))
52 end
45
53
46 def test_show_by_id
54 def test_show_by_id
47 get :show, :id => 1
55 get :show, :id => 1
@@ -25,14 +25,15 module Redmine
25 module ClassMethods
25 module ClassMethods
26 def acts_as_event(options = {})
26 def acts_as_event(options = {})
27 return if self.included_modules.include?(Redmine::Acts::Event::InstanceMethods)
27 return if self.included_modules.include?(Redmine::Acts::Event::InstanceMethods)
28 options[:datetime] ||= :created_on
28 default_options = { :datetime => :created_on,
29 options[:title] ||= :title
29 :title => :title,
30 options[:description] ||= :description
30 :description => :description,
31 options[:author] ||= :author
31 :author => :author,
32 options[:url] ||= {:controller => 'welcome'}
32 :url => {:controller => 'welcome'},
33 options[:type] ||= self.name.underscore.dasherize
33 :type => self.name.underscore.dasherize }
34
34 cattr_accessor :event_options
35 cattr_accessor :event_options
35 self.event_options = options
36 self.event_options = default_options.merge(options)
36 send :include, Redmine::Acts::Event::InstanceMethods
37 send :include, Redmine::Acts::Event::InstanceMethods
37 end
38 end
38 end
39 end
General Comments 0
You need to be logged in to leave comments. Login now