= Assertions
assert_contains ['a', '1'], /a/
assert_does_not_contain ['a', '1'], /b/
assert_same_elements [1, 2, 3], [3, 2, 1]
assert_bad_value User, :birthdate, "Older than you!"
assert_good_value User, :email, "bob@email.com"
assert_save @user
assert_valid @user
assert_sent_email do |email|
email.subject =~ /activated/ && email.to.include?('bob@email.com')
end
assert_did_not_send_email do |email|
email.subject =~ /activated/ && email.to.include?('bob@email.com')
end
assert_xml_response
= Macros
should_allow_values_for
should_assign_to
should_be_restful
should_belong_to
should_change
should_ensure_length_at_least
should_ensure_length_in_range
should_ensure_length_is
should_ensure_value_in_range
should_eventually
should_have_and_belong_to_many
should_have_class_methods
should_have_db_column
should_have_db_columns
should_have_indices
should_have_instance_methods
should_have_many
should_have_named_scope
should_have_one
should_have_readonly_attributes
should_not_allow_values_for
should_not_assign_to
should_not_change
should_not_set_the_flash
should_only_allow_numeric_values_for
should_protect_attributes
should_redirect_to
should_render_a_form
should_render_template
should_require_acceptance_of
should_require_attributes
should_require_unique_attributes
should_respond_with
should_respond_with_xml_for
should_set_the_flash_to
cheat sheets.
$ cheat shoulda( add new | see all )
- updated sheets

- mysql_select
- cheat
- cryptsetup
- burm
- perl
- port
- yuilang
- queriac
- mechanize
- sness
- nonsense
- haml
- git
- assert_valid
- marsmission
Advertisement