Skip to content

Instantly share code, notes, and snippets.

@leejarvis
Last active December 10, 2015 07:18
Show Gist options
  • Save leejarvis/4400042 to your computer and use it in GitHub Desktop.
Save leejarvis/4400042 to your computer and use it in GitHub Desktop.
require 'test_helper'
class AccountTest < ActiveSupport::TestCase
test 'presence on create' do
account = Account.create
refute account.valid?
end
test 'inclusion :subtype' do
# invalid
account = Account.create(subtype: 'invalid')
refute account.valid?
# valid
%w[c gc cdc].each do |subtype|
account = Account.create(subtype: subtype)
assert account.valid?
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment