From e9e98b91489c1f01769cb7dcd0fd30d49ba01671 Mon Sep 17 00:00:00 2001 From: Joe Ferris Date: Mon, 26 Jan 2009 18:34:04 -0500 Subject: [PATCH] Added documentation in Shoulda::ActiveRecord::Matchers and mentioned Matchers in the README --- README.rdoc | 1 + active_record_progress.txt | 27 --------------------------- lib/shoulda/active_record/matchers.rb | 27 +++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 27 deletions(-) delete mode 100644 active_record_progress.txt diff --git a/README.rdoc b/README.rdoc index 3f77b933..1a886853 100644 --- a/README.rdoc +++ b/README.rdoc @@ -7,6 +7,7 @@ Helpers:: #context and #should give you rSpec like test blocks. Macros:: Generate hundreds of lines of Controller and ActiveRecord tests with these powerful macros. They get you started quickly, and can help you ensure that your application is conforming to best practices. Assertions:: Many common rails testing idioms have been distilled into a set of useful assertions. +Matchers:: Rspec-compatible matchers providing the same tests as Shoulda macros. = Usage diff --git a/active_record_progress.txt b/active_record_progress.txt deleted file mode 100644 index 15fd4bc5..00000000 --- a/active_record_progress.txt +++ /dev/null @@ -1,27 +0,0 @@ -Not necessary: -load_all_fixtures -should_have_class_methods -should_have_instance_methods - -Complete: -should_allow_values_for -should_belong_to -should_ensure_length_at_least -should_ensure_length_in_range -should_ensure_length_is -should_ensure_value_in_range -should_have_and_belong_to_many -should_have_many -should_have_one -should_not_allow_values_for -should_require_attributes -should_require_unique_attributes -should_only_allow_numeric_values_for -should_require_acceptance_of -should_have_db_columns -should_have_db_column -should_have_index -should_have_indices -should_have_readonly_attributes -should_protect_attributes -should_have_named_scope diff --git a/lib/shoulda/active_record/matchers.rb b/lib/shoulda/active_record/matchers.rb index bdd98951..ac18a888 100644 --- a/lib/shoulda/active_record/matchers.rb +++ b/lib/shoulda/active_record/matchers.rb @@ -13,3 +13,30 @@ require 'shoulda/active_record/matchers/have_index_matcher' require 'shoulda/active_record/matchers/have_readonly_attribute_matcher' require 'shoulda/active_record/matchers/protect_attribute_matcher' require 'shoulda/active_record/matchers/have_named_scope_matcher' + + +module Shoulda # :nodoc: + module ActiveRecord # :nodoc: + # = Matchers for your active record models + # + # These matchers will test most of the validations and associations for your + # ActiveRecord models. + # + # describe User do + # it { should require_attribute(:name) } + # it { should require_attribute(:phone_number) } + # %w(abcd 1234).each do |value| + # it { should_not allow_value(value).for(:phone_number) } + # end + # it { should allow_value("(123) 456-7890").for(:phone_number) } + # it { should protect_attribute(:password) } + # it { should have_one(:profile) } + # it { should have_many(:dogs) } + # it { should have_many(:messes).through(:dogs) } + # it { should belong_to(:lover) } + # end + # + module Matchers + end + end +end