]> source.dussan.org Git - redmine.git/commitdiff
Fixed: no :author method error on projects atom feed (#1623).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 12 Jul 2008 09:42:18 +0000 (09:42 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 12 Jul 2008 09:42:18 +0000 (09:42 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1653 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/project.rb
test/functional/projects_controller_test.rb
vendor/plugins/acts_as_event/lib/acts_as_event.rb

index 67e6c0e396ac6b3601861c5ac415e9cca21ec3e8..5679344bc7063dde68d849e75ee7ab070dd9343c 100644 (file)
@@ -48,7 +48,8 @@ class Project < ActiveRecord::Base
   acts_as_customizable
   acts_as_searchable :columns => ['name', 'description'], :project_key => 'id', :permission => nil
   acts_as_event :title => Proc.new {|o| "#{l(:label_project)}: #{o.name}"},
-                :url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o.id}}
+                :url => Proc.new {|o| {:controller => 'projects', :action => 'show', :id => o.id}},
+                :author => nil
 
   attr_protected :status, :enabled_module_names
   
index 88a9fae6062621187b6c3a0243051b7bb9910fe4..f5f1c6733d3836721ff3ea9338dafc86d797824d 100644 (file)
@@ -42,6 +42,14 @@ class ProjectsControllerTest < Test::Unit::TestCase
     # Subproject in corresponding value
     assert assigns(:project_tree)[Project.find(1)].include?(Project.find(3))
   end\r
+  
+  def test_index_atom
+    get :index, :format => 'atom'
+    assert_response :success
+    assert_template 'common/feed.atom.rxml'
+    assert_select 'feed>title', :text => 'Redmine: Latest projects'
+    assert_select 'feed>entry', :count => Project.count(:conditions => Project.visible_by(User.current))
+  end
   \r
   def test_show_by_id\r
     get :show, :id => 1\r
index d7f437a5e22515825fd81d49a53a55b32ab0edf1..0b7ad21f5434275061cc59326fb13ffa59d63b74 100644 (file)
@@ -25,14 +25,15 @@ module Redmine
       module ClassMethods
         def acts_as_event(options = {})
           return if self.included_modules.include?(Redmine::Acts::Event::InstanceMethods)
-          options[:datetime] ||= :created_on
-          options[:title] ||= :title
-          options[:description] ||= :description
-          options[:author] ||= :author
-          options[:url] ||= {:controller => 'welcome'}
-          options[:type] ||= self.name.underscore.dasherize
+          default_options = { :datetime => :created_on,
+                              :title => :title,
+                              :description => :description,
+                              :author => :author,
+                              :url => {:controller => 'welcome'},
+                              :type => self.name.underscore.dasherize }
+                              
           cattr_accessor :event_options
-          self.event_options = options 
+          self.event_options = default_options.merge(options)
           send :include, Redmine::Acts::Event::InstanceMethods
         end
       end