Replaces find(:all) calls.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10917 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -34,7 +34,7 @@ class RolesControllerTest < ActionController::TestCase
|
||||
assert_template 'index'
|
||||
|
||||
assert_not_nil assigns(:roles)
|
||||
assert_equal Role.find(:all, :order => 'builtin, position'), assigns(:roles)
|
||||
assert_equal Role.order('builtin, position').all, assigns(:roles)
|
||||
|
||||
assert_tag :tag => 'a', :attributes => { :href => '/roles/1/edit' },
|
||||
:content => 'Manager'
|
||||
@@ -163,7 +163,7 @@ class RolesControllerTest < ActionController::TestCase
|
||||
assert_template 'permissions'
|
||||
|
||||
assert_not_nil assigns(:roles)
|
||||
assert_equal Role.find(:all, :order => 'builtin, position'), assigns(:roles)
|
||||
assert_equal Role.order('builtin, position').all, assigns(:roles)
|
||||
|
||||
assert_tag :tag => 'input', :attributes => { :type => 'checkbox',
|
||||
:name => 'permissions[3][]',
|
||||
|
||||
@@ -306,7 +306,10 @@ class WorkflowsControllerTest < ActionController::TestCase
|
||||
|
||||
# Returns an array of status transitions that can be compared
|
||||
def status_transitions(conditions)
|
||||
WorkflowTransition.find(:all, :conditions => conditions,
|
||||
:order => 'tracker_id, role_id, old_status_id, new_status_id').collect {|w| [w.old_status, w.new_status_id]}
|
||||
WorkflowTransition.
|
||||
where(conditions).
|
||||
order('tracker_id, role_id, old_status_id, new_status_id').
|
||||
all.
|
||||
collect {|w| [w.old_status, w.new_status_id]}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -139,7 +139,7 @@ RAW
|
||||
# link image
|
||||
'!logo.gif!:http://foo.bar/' => '<a href="http://foo.bar/"><img src="/attachments/download/3" title="This is a logo" alt="This is a logo" /></a>',
|
||||
}
|
||||
attachments = Attachment.find(:all)
|
||||
attachments = Attachment.all
|
||||
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :attachments => attachments) }
|
||||
end
|
||||
|
||||
|
||||
@@ -367,7 +367,7 @@ class IssueNestedSetTest < ActiveSupport::TestCase
|
||||
c.reload
|
||||
|
||||
assert_equal 5, c.issues.count
|
||||
ic1, ic2, ic3, ic4, ic5 = c.issues.find(:all, :order => 'subject')
|
||||
ic1, ic2, ic3, ic4, ic5 = c.issues.order('subject').all
|
||||
assert ic1.root?
|
||||
assert_equal ic1, ic2.parent
|
||||
assert_equal ic1, ic3.parent
|
||||
|
||||
@@ -183,7 +183,7 @@ class ProjectTest < ActiveSupport::TestCase
|
||||
# 2 active members
|
||||
assert_equal 2, @ecookbook.members.size
|
||||
# and 1 is locked
|
||||
assert_equal 3, Member.find(:all, :conditions => ['project_id = ?', @ecookbook.id]).size
|
||||
assert_equal 3, Member.where('project_id = ?', @ecookbook.id).all.size
|
||||
# some boards
|
||||
assert @ecookbook.boards.any?
|
||||
|
||||
@@ -693,7 +693,7 @@ class ProjectTest < ActiveSupport::TestCase
|
||||
|
||||
def test_activities_should_use_the_system_activities
|
||||
project = Project.find(1)
|
||||
assert_equal project.activities, TimeEntryActivity.find(:all, :conditions => {:active => true} )
|
||||
assert_equal project.activities, TimeEntryActivity.where(:active => true).all
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ class RepositoryBazaarTest < ActiveSupport::TestCase
|
||||
@project.reload
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
# Remove changesets with revision > 5
|
||||
@repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 2}
|
||||
@repository.changesets.all.each {|c| c.destroy if c.revision.to_i > 2}
|
||||
@project.reload
|
||||
assert_equal 2, @repository.changesets.count
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase
|
||||
assert_equal CHANGESETS_NUM, @repository.changesets.count
|
||||
|
||||
# Remove changesets with revision > 3
|
||||
@repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 3}
|
||||
@repository.changesets.all.each {|c| c.destroy if c.revision.to_i > 3}
|
||||
@project.reload
|
||||
assert_equal 3, @repository.changesets.count
|
||||
assert_equal %w|3 2 1|, @repository.changesets.all.collect(&:revision)
|
||||
|
||||
@@ -79,7 +79,7 @@ class RepositoryDarcsTest < ActiveSupport::TestCase
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
|
||||
# Remove changesets with revision > 3
|
||||
@repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 3}
|
||||
@repository.changesets.all.each {|c| c.destroy if c.revision.to_i > 3}
|
||||
@project.reload
|
||||
assert_equal 3, @repository.changesets.count
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
||||
@project.reload
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
# Remove changesets with revision > 2
|
||||
@repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 2}
|
||||
@repository.changesets.all.each {|c| c.destroy if c.revision.to_i > 2}
|
||||
@project.reload
|
||||
assert_equal 3, @repository.changesets.count
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
||||
assert_equal NUM_REV, @repository.changesets.count
|
||||
|
||||
# Remove changesets with revision > 5
|
||||
@repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 5}
|
||||
@repository.changesets.all.each {|c| c.destroy if c.revision.to_i > 5}
|
||||
@project.reload
|
||||
assert_equal 5, @repository.changesets.count
|
||||
|
||||
|
||||
Reference in New Issue
Block a user