- def diary_entry_valid(attrs, result = true)
- entry = DiaryEntry.new(attributes_for(:diary_entry))
- entry.assign_attributes(attrs)
- assert_equal result, entry.valid?, "Expected #{attrs.inspect} to be #{result}"
+ def diary_entry_valid(attrs, valid: true)
+ entry = build(:diary_entry, attrs)
+ assert_equal valid, entry.valid?, "Expected #{attrs.inspect} to be #{valid}"