Rails4: replace deprecated Relation#first with finder options at WikiContentTest
git-svn-id: http://svn.redmine.org/redmine/trunk@12565 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
d305d15373
commit
a6da09026a
|
@ -67,7 +67,7 @@ class WikiContentTest < ActiveSupport::TestCase
|
||||||
assert_equal version_count+1, content.version
|
assert_equal version_count+1, content.version
|
||||||
assert_equal version_count+1, content.versions.length
|
assert_equal version_count+1, content.versions.length
|
||||||
|
|
||||||
version = WikiContent::Version.first(:order => 'id DESC')
|
version = WikiContent::Version.order('id DESC').first
|
||||||
assert_equal @page.id, version.page_id
|
assert_equal @page.id, version.page_id
|
||||||
assert_equal '', version.compression
|
assert_equal '', version.compression
|
||||||
assert_equal "My new content", version.data
|
assert_equal "My new content", version.data
|
||||||
|
@ -83,7 +83,7 @@ class WikiContentTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
version = WikiContent::Version.first(:order => 'id DESC')
|
version = WikiContent::Version.order('id DESC').first
|
||||||
assert_equal @page.id, version.page_id
|
assert_equal @page.id, version.page_id
|
||||||
assert_equal 'gzip', version.compression
|
assert_equal 'gzip', version.compression
|
||||||
assert_not_equal "My new content", version.data
|
assert_not_equal "My new content", version.data
|
||||||
|
@ -121,8 +121,8 @@ class WikiContentTest < ActiveSupport::TestCase
|
||||||
def test_current_version
|
def test_current_version
|
||||||
content = WikiContent.find(11)
|
content = WikiContent.find(11)
|
||||||
assert_equal true, content.current_version?
|
assert_equal true, content.current_version?
|
||||||
assert_equal true, content.versions.first(:order => 'version DESC').current_version?
|
assert_equal true, content.versions.order('version DESC').first.current_version?
|
||||||
assert_equal false, content.versions.first(:order => 'version ASC').current_version?
|
assert_equal false, content.versions.order('version ASC').first.current_version?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_previous_for_first_version_should_return_nil
|
def test_previous_for_first_version_should_return_nil
|
||||||
|
|
Loading…
Reference in New Issue