Created
September 4, 2011 12:45
-
-
Save wojtekmach/1192809 to your computer and use it in GitHub Desktop.
minitest-matchers + valid_attribute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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