X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/34e3e51456774127d43408b7ab65c24f41373f62..76d365ce71b942466d07480ded13098860d4f1b3:/test/models/diary_entry_test.rb diff --git a/test/models/diary_entry_test.rb b/test/models/diary_entry_test.rb index 12fd69512..58e6513a6 100644 --- a/test/models/diary_entry_test.rb +++ b/test/models/diary_entry_test.rb @@ -1,31 +1,31 @@ -require 'test_helper' +require "test_helper" class DiaryEntryTest < ActiveSupport::TestCase api_fixtures fixtures :diary_entries, :diary_comments, :languages def test_diary_entry_count - assert_equal 5, DiaryEntry.count + assert_equal 6, DiaryEntry.count end def test_diary_entry_validations diary_entry_valid({}) - diary_entry_valid({:title => ''}, false) - diary_entry_valid({:title => 'a'*255}) - diary_entry_valid({:title => 'a'*256}, false) - diary_entry_valid({:body => ''}, false) - diary_entry_valid({:latitude => 90}) - diary_entry_valid({:latitude => 90.00001}, false) - diary_entry_valid({:latitude => -90}) - diary_entry_valid({:latitude => -90.00001}, false) - diary_entry_valid({:longitude => 180}) - diary_entry_valid({:longitude => 180.00001}, false) - diary_entry_valid({:longitude => -180}) - diary_entry_valid({:longitude => -180.00001}, false) + diary_entry_valid({ :title => "" }, false) + diary_entry_valid(:title => "a" * 255) + diary_entry_valid({ :title => "a" * 256 }, false) + diary_entry_valid({ :body => "" }, false) + diary_entry_valid(:latitude => 90) + diary_entry_valid({ :latitude => 90.00001 }, false) + diary_entry_valid(:latitude => -90) + diary_entry_valid({ :latitude => -90.00001 }, false) + diary_entry_valid(:longitude => 180) + diary_entry_valid({ :longitude => 180.00001 }, false) + diary_entry_valid(:longitude => -180) + diary_entry_valid({ :longitude => -180.00001 }, false) end def test_diary_entry_visible - assert_equal 4, DiaryEntry.visible.count + assert_equal 5, DiaryEntry.visible.count assert_raise ActiveRecord::RecordNotFound do DiaryEntry.visible.find(diary_entries(:deleted_entry).id) end @@ -41,7 +41,7 @@ class DiaryEntryTest < ActiveSupport::TestCase assert_equal 1, diary_entries(:normal_user_geo_entry).visible_comments.count end -private + private def diary_entry_valid(attrs, result = true) entry = DiaryEntry.new(diary_entries(:normal_user_entry_1).attributes)