mirror of
https://github.com/thoughtbot/shoulda-matchers.git
synced 2022-11-09 12:01:38 -05:00
Added documentation in Shoulda::ActiveRecord::Matchers and mentioned Matchers in the README
This commit is contained in:
parent
4066eb9782
commit
e9e98b9148
3 changed files with 28 additions and 27 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue