Skip to content

Instantly share code, notes, and snippets.

View kristjan's full-sized avatar

Kristján Pétursson kristjan

View GitHub Profile
@kristjan
kristjan / examples.rb
Created May 22, 2010 01:16
Some rspec macros to verify Rails model validations
# Require fields.
it_should_require :wish, :author, :title, :body, :signature
# Validate string lengths
it_should_validate_strings :body => 1024, :title => 255, :signature => 25
# Strings can be absent. Default length is 255, like Rails.
it_should_validate_strings :story => 10000,
:blurb => {:optional => true},
:tagline => {:optional => true}