Skip to content

Instantly share code, notes, and snippets.

@maceto
Created March 22, 2012 18:02
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 maceto/2161158 to your computer and use it in GitHub Desktop.
Save maceto/2161158 to your computer and use it in GitHub Desktop.
minitest validates presence true
require "minitest_helper"
describe Street do
it "must have a code" do
# No code
street = Street.new
# Invalid
street.valid?.must_equal false
# Code assignation (random 1000/10000)
street.code = rand(9000) + 1000
# Valid
street.valid?.must_equal true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment