]> git.openstreetmap.org Git - rails.git/commitdiff
Build a diary entry more succinctly
authorAndy Allan <git@gravitystorm.co.uk>
Thu, 8 Sep 2016 08:06:46 +0000 (09:06 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Thu, 8 Sep 2016 08:06:46 +0000 (09:06 +0100)
test/models/diary_entry_test.rb

index 6981ebc43f1ada17ccb0e4bc04422d663654687f..5586b74d2e7b5d0c939e8ce50ae50199689daa9f 100644 (file)
@@ -44,8 +44,7 @@ class DiaryEntryTest < ActiveSupport::TestCase
   private
 
   def diary_entry_valid(attrs, result = true)
-    entry = DiaryEntry.new(attributes_for(:diary_entry))
-    entry.assign_attributes(attrs)
+    entry = build(:diary_entry, attrs)
     assert_equal result, entry.valid?, "Expected #{attrs.inspect} to be #{result}"
   end
 end