openstreetmap-website/test/models/diary_comment_test.rb
Andy Allan c365e2b28a Convert the languages fixtures to a factory
For some tests, the existance of an 'en' language is assumed by
the database structure (not null default 'en'::character varying) so
this can be created in a setup block.
2016-10-26 13:14:52 +01:00

16 lines
402 B
Ruby

require "test_helper"
class DiaryCommentTest < ActiveSupport::TestCase
fixtures :users
def setup
# Create the default language for diary entries
create(:language, :code => "en")
end
test "body must be present" do
comment = build(:diary_comment, :body => "")
assert_not comment.valid?
assert_not_nil comment.errors[:body], "no validation error for missing body"
end
end