Skip to content

Instantly share code, notes, and snippets.

@wojtekmach
Created September 4, 2011 12:45
Show Gist options
  • Save wojtekmach/1192809 to your computer and use it in GitHub Desktop.
Save wojtekmach/1192809 to your computer and use it in GitHub Desktop.
minitest-matchers + valid_attribute
# you have to use https://github.com/wojtekmach/valid_attribute/tree/minitest
require "minitest/autorun"
require "minitest/matchers"
require "active_model"
require "valid_attribute"
class Post
include ActiveModel::Validations
attr_accessor :title
validates :title, :presence => true
end
describe Post do
subject { Post.new }
must { have_valid(:title).when("Good") }
wont { have_valid(:title).when(nil, "") }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment