This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Mon Apr 21 03:06:56 -0700 2008 | [freelancing-god] |
| |
MIT-LICENSE | Wed Aug 22 20:03:28 -0700 2007 | [freelancing-god] |
| |
README | Mon Apr 21 02:53:27 -0700 2008 | [freelancing-god] |
| |
Rakefile | Mon Apr 21 03:06:09 -0700 2008 | [freelancing-god] |
| |
init.rb | Mon Apr 21 02:50:46 -0700 2008 | [freelancing-god] |
| |
lib/ | Mon Apr 21 03:06:09 -0700 2008 | [freelancing-god] |
README
== Active Matchers Some helpful rspec matchers for testing validations and associations. It is not complete, especially in the case of validations, and lacking in documentation, but might be useful nonetheless. To install: script/plugin install http://rails-oceania.googlecode.com/svn/patallan/active_matchers/ Make sure, in your spec_helper.rb file, you add an include as follows: config.include ActiveMatchers::Matchers I'd like to make that automatic, but haven't figured out how to just yet. === Examples Test validates_presence_of :name Model.should need(:name).using(@valid_attributes) Test validates_uniqueness_of :name Model.should need(:name).to_be_unique.using(@valid_attributes) Test presence of at least one field being required Model.should need.one_of(:first_name, :last_name).using(@valid_attributes) Test validates_length_of :name matches database field length Model.should limit_length_of(:name).using(@valid_attributes) Test validates_length_of :name, :maximum => 255 Model.should limit_length_of(:name).to(255).using(@valid_attributes) You can group multiple validation checks together like so: using(@valid_attributes) do Model.should need(:name) Model.should limit_length_of(:name).to(255) end Also allows confirmation of the presence of associations Test belongs_to :parent Model.should belong_to(:parent) Test belongs_to :parent, :class_name => "CustomClass", :foreign_key => "some_id" Model.should belong_to(:parent).with_options( :class_name => "CustomClass", :foreign_key => "some_id") Test has_many :items Model.should have_many(:items) Test has_many :items, :class_name => "CustomClass", :foreign_key => "some_id" Model.should have_many(:items).with_options( :class_name => "CustomClass", :foreign_key => "some_id") Similar testing available for has_one (Model.should have_one) and has_and_belongs_to_many (Model.should have_and_belong_to_many) Copyright (c) 2007 Pat Allan & James Healy, released under the MIT license




