Commit 9cd55d8d authored by Tim Felgentreff's avatar Tim Felgentreff

more test fixes

parent d1ba2735
......@@ -33,7 +33,7 @@ class Attachment < ActiveRecord::Base
acts_as_journalized :event_title => :filename,
:event_url => (Proc.new do |o|
{ :controller => 'attachments', :action => 'download',
:id => o.versioned_id, :filename => o.filename }
:id => o.journaled_id, :filename => o.filename }
end),
:activity_type => 'files',
:activity_permission => :view_files,
......
......@@ -36,7 +36,7 @@ class Issue < ActiveRecord::Base
acts_as_customizable
acts_as_watchable
acts_as_journalized :event_title => Proc.new {|o| "#{o.tracker.name} ##{o.versioned.id} (#{o.status}): #{o.subject}"},
acts_as_journalized :event_title => Proc.new {|o| "#{o.tracker.name} ##{o.journaled.id} (#{o.status}): #{o.subject}"},
:event_type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') }
register_on_journal_formatter(:id, 'parent_id')
......
......@@ -490,7 +490,7 @@ class Query < ActiveRecord::Base
# Returns the journals
# Valid options are :order, :offset, :limit
def journals(options={})
Journal.find :all, :include => [:details, :user, {:issue => [:project, :author, :tracker, :status]}],
Journal.find :all, :include => [:user, {:issue => [:project, :author, :tracker, :status]}],
:conditions => statement,
:order => options[:order],
:limit => options[:limit],
......
......@@ -7,7 +7,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema)
xml.author { xml.name "#{Setting.app_title}" }
@journals.each do |change|
issue = change.issue
issue = change.journaled
xml.entry do
xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}"
xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false)
......
......@@ -280,7 +280,7 @@ module Redmine
pdf.SetFontStyle('B',9)
pdf.Cell(190,5, l(:label_history), "B")
pdf.Ln
for journal in issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC")
for journal in issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_at ASC")
pdf.SetFontStyle('B',8)
pdf.Cell(190,5, format_time(journal.created_at) + " - " + journal.user.name)
pdf.Ln
......
......@@ -676,9 +676,9 @@ class IssuesControllerTest < ActionController::TestCase
:category_id => '1' # no change
}
end
assert Issue.current_journal.changes.has_key? "subject"
assert Issue.current_journal.changes.has_key? "priority_id"
assert !Issue.current_journal.changes.has_key?("category_id")
assert issue.current_journal.changes.has_key? "subject"
assert issue.current_journal.changes.has_key? "priority_id"
assert !issue.current_journal.changes.has_key?("category_id")
assert_redirected_to :action => 'show', :id => '1'
issue.reload
......@@ -704,10 +704,10 @@ class IssuesControllerTest < ActionController::TestCase
:custom_field_values => { '2' => 'New custom value' }
}
end
assert Issue.current_journal.changes.has_key? "subject"
assert Issue.current_journal.changes.has_key? "priority_id"
assert !Issue.current_journal.changes.has_key?("category_id")
assert Issue.current_journal.changes.has_key? "2"
assert issue.current_journal.changes.has_key? "subject"
assert issue.current_journal.changes.has_key? "priority_id"
assert !issue.current_journal.changes.has_key?("category_id")
assert issue.current_journal.changes.has_key? "2"
assert_redirected_to :action => 'show', :id => '1'
issue.reload
......@@ -797,7 +797,7 @@ class IssuesControllerTest < ActionController::TestCase
j = Issue.find(1).journals.find(:first, :order => 'id DESC')
assert j.notes.blank?
assert_equal 1, j.details.size
assert_equal 'testfile.txt', j.details.first.value
assert_equal 'testfile.txt', j.details.first.last
assert_equal User.anonymous, j.user
mail = ActionMailer::Base.deliveries.last
......@@ -948,7 +948,7 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal [7, 7], Issue.find_all_by_id([1, 2]).collect {|i| i.priority.id}
issue = Issue.find(1)
journal = issue.journals.find(:first, :order => 'created_on DESC')
journal = issue.journals.find(:first, :order => 'created_at DESC')
assert_equal '125', issue.custom_value_for(2).value
assert_equal 'Bulk editing', journal.notes
assert_equal 1, journal.details.size
......
......@@ -84,7 +84,7 @@ class WikiControllerTest < ActionController::TestCase
:page => 'New page',
:content => {:comments => 'Created the page',
:text => "h1. New page\n\nThis is a new page",
:version => 0}
:lock_version => 0}
assert_redirected_to :action => 'index', :id => 'ecookbook', :page => 'New_page'
page = Project.find(1).wiki.find_page('New page')
assert !page.new_record?
......@@ -100,7 +100,7 @@ class WikiControllerTest < ActionController::TestCase
:page => 'New page',
:content => {:comments => 'Created the page',
:text => "h1. New page\n\nThis is a new page",
:version => 0},
:lock_version => 0},
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
end
end
......
......@@ -79,8 +79,8 @@ class ActivityTest < ActiveSupport::TestCase
assert_kind_of Array, events
assert events.include?(Attachment.find_by_container_type_and_container_id('Project', 1).last_journal)
assert events.include?(Attachment.find_by_container_type_and_container_id('Version', 1).last_journal)
assert_equal [Attachment], events.collect(&:class).uniq
assert_equal %w(Project Version), events.collect(&:container_type).uniq.sort
assert_equal [Attachment], events.collect(&:journaled).collect(&:class).uniq
assert_equal %w(Project Version), events.collect(&:journaled).collect(&:container_type).uniq.sort
end
private
......
......@@ -171,7 +171,7 @@ class MailerTest < ActiveSupport::TestCase
mail = ActionMailer::Base.deliveries.last
assert_not_nil mail
assert_equal Mailer.message_id_for(journal), mail.message_id
assert_equal Mailer.message_id_for(journal.versioned), mail.references.first.to_s
assert_equal Mailer.message_id_for(journal.journaled), mail.references.first.to_s
end
def test_message_posted_message_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment