]> source.dussan.org Git - redmine.git/commitdiff
Rails4: replace deprecated Relation#first with finder options at WikiContentTest
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 9 Jan 2014 06:43:49 +0000 (06:43 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 9 Jan 2014 06:43:49 +0000 (06:43 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12565 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/wiki_content_test.rb

index 10d9cea8af6188e5ebd08d154861491d484b38fd..2e5f4a2d4ccc013901485094eaa52e48cbf0af85 100644 (file)
@@ -67,7 +67,7 @@ class WikiContentTest < ActiveSupport::TestCase
     assert_equal version_count+1, content.version
     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 '', version.compression
     assert_equal "My new content", version.data
@@ -83,7 +83,7 @@ class WikiContentTest < ActiveSupport::TestCase
       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 'gzip', version.compression
     assert_not_equal "My new content", version.data
@@ -121,8 +121,8 @@ class WikiContentTest < ActiveSupport::TestCase
   def test_current_version
     content = WikiContent.find(11)
     assert_equal true, content.current_version?
-    assert_equal true, content.versions.first(:order => 'version DESC').current_version?
-    assert_equal false, content.versions.first(:order => 'version ASC').current_version?
+    assert_equal true, content.versions.order('version DESC').first.current_version?
+    assert_equal false, content.versions.order('version ASC').first.current_version?
   end
 
   def test_previous_for_first_version_should_return_nil