Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giovannibenussi/b1016a4b158aed31d304e138eddf8b34 to your computer and use it in GitHub Desktop.
Save giovannibenussi/b1016a4b158aed31d304e138eddf8b34 to your computer and use it in GitHub Desktop.
it "can't be saved without an user" do
post = Post.new
post.user = nil
expect { post.save!(validate: false) }.to raise_error ActiveRecord::NotNullViolation
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment