diff --git a/lib/shoulda/action_controller/macros.rb b/lib/shoulda/action_controller/macros.rb
index aeafb0d6..3bf18f7d 100644
--- a/lib/shoulda/action_controller/macros.rb
+++ b/lib/shoulda/action_controller/macros.rb
@@ -24,6 +24,8 @@ module ActionController # :nodoc:
module Macros
include Matchers
+ # Deprecated: use ActionController::Matchers#set_the_flash instead.
+ #
# Macro that creates a test asserting that the flash contains the given
# value. Expects a +String+ or +Regexp+.
#
@@ -36,12 +38,16 @@ def should_set_the_flash_to(val)
should set_the_flash.to(val)
end
+ # Deprecated: use ActionController::Matchers#set_the_flash instead.
+ #
# Macro that creates a test asserting that the flash is empty.
def should_not_set_the_flash
::ActiveSupport::Deprecation.warn("use: should_not set_the_flash")
should_not set_the_flash
end
+ # Deprecated: use ActionController::Matchers#filter_param instead.
+ #
# Macro that creates a test asserting that filter_parameter_logging
# is set for the specified keys
#
@@ -55,6 +61,8 @@ def should_filter_params(*keys)
end
end
+ # Deprecated: use ActionController::Matchers#assign_to instead.
+ #
# Macro that creates a test asserting that the controller assigned to
# each of the named instance variable(s).
#
@@ -79,6 +87,8 @@ def should_assign_to(*names, &block)
end
end
+ # Deprecated: use ActionController::Matchers#assign_to instead.
+ #
# Macro that creates a test asserting that the controller did not assign to
# any of the named instance variable(s).
#
@@ -92,6 +102,8 @@ def should_not_assign_to(*names)
end
end
+ # Deprecated: use ActionController::Matchers#respond_with instead.
+ #
# Macro that creates a test asserting that the controller responded with a 'response' status code.
# Example:
#
@@ -101,6 +113,8 @@ def should_respond_with(response)
should respond_with(response)
end
+ # Deprecated: use ActionController::Matchers#respond_with_content_type instead.
+ #
# Macro that creates a test asserting that the response content type was 'content_type'.
# Example:
#
@@ -112,6 +126,8 @@ def should_respond_with_content_type(content_type)
should respond_with_content_type(content_type)
end
+ # Deprecated: use ActionController::Matchers#set_session instead.
+ #
# Macro that creates a test asserting that a value returned from the
# session is correct. Expects the session key as a parameter, and a block
# that returns the expected value.
@@ -127,6 +143,8 @@ def should_set_session(key, &block)
should matcher
end
+ # Deprecated: use ActionController::Matchers#render_template instead.
+ #
# Macro that creates a test asserting that the controller rendered the given template.
# Example:
#
@@ -136,6 +154,8 @@ def should_render_template(template)
should render_template(template)
end
+ # Deprecated: use ActionController::Matchers#render_with_layout instead.
+ #
# Macro that creates a test asserting that the controller rendered with the given layout.
# Example:
#
@@ -145,6 +165,8 @@ def should_render_with_layout(expected_layout = 'application')
should render_with_layout(expected_layout)
end
+ # Deprecated: use ActionController::Matchers#render_with_layout instead.
+ #
# Macro that creates a test asserting that the controller rendered without a layout.
# Same as @should_render_with_layout false@
def should_render_without_layout
@@ -152,6 +174,8 @@ def should_render_without_layout
should_not render_with_layout
end
+ # Deprecated: use ActionController::Matchers#redirect_to instead.
+ #
# Macro that creates a test asserting that the controller returned a
# redirect to the given path. The passed description will be used when
# generating a test name. Expects a block that returns the expected path
@@ -165,6 +189,8 @@ def should_redirect_to(description, &block)
should redirect_to(description, &block)
end
+ # Deprecated: use ActionController::Matchers#route instead.
+ #
# Macro that creates a routing test. It tries to use the given HTTP
# +method+ on the given +path+, and asserts that it routes to the
# given +options+.
diff --git a/lib/shoulda/active_record/macros.rb b/lib/shoulda/active_record/macros.rb
index 8086c824..ece6dae6 100644
--- a/lib/shoulda/active_record/macros.rb
+++ b/lib/shoulda/active_record/macros.rb
@@ -23,6 +23,8 @@ module Macros
include Helpers
include Matchers
+ # Deprecated: use ActiveRecord::Matchers#validate_presence_of instead.
+ #
# Ensures that the model cannot be saved if one of the attributes listed is not present.
#
# Options:
@@ -40,12 +42,13 @@ def should_validate_presence_of(*attributes)
should validate_presence_of(attribute).with_message(message)
end
end
-
+
+ # Deprecated: use ActiveRecord::Matchers#validate_uniqueness_of instead.
+ #
# Ensures that the model cannot be saved if one of the attributes listed is not unique.
# Requires an existing record
#
# Options:
-
# * :message - value the test expects to find in errors.on(:attribute).
# Regexp or string. Default = I18n.translate('activerecord.errors.messages.taken')
# * :scoped_to - field(s) to scope the uniqueness to.
@@ -73,6 +76,8 @@ def should_validate_uniqueness_of(*attributes)
end
end
+ # Deprecated: use ActiveRecord::Matchers#allow_mass_assignment_of instead.
+ #
# Ensures that the attribute can be set on mass update.
#
# should_allow_mass_assignment_of :first_name, :last_name
@@ -86,6 +91,8 @@ def should_allow_mass_assignment_of(*attributes)
end
end
+ # Deprecated: use ActiveRecord::Matchers#allow_mass_assignment_of instead.
+ #
# Ensures that the attribute cannot be set on mass update.
#
# should_not_allow_mass_assignment_of :password, :admin_flag
@@ -99,6 +106,8 @@ def should_not_allow_mass_assignment_of(*attributes)
end
end
+ # Deprecated: use ActiveRecord::Matchers#have_readonly_attribute instead.
+ #
# Ensures that the attribute cannot be changed once the record has been created.
#
# should_have_readonly_attributes :password, :admin_flag
@@ -112,6 +121,8 @@ def should_have_readonly_attributes(*attributes)
end
end
+ # Deprecated: use ActiveRecord::Matchers#allow_value instead.
+ #
# Ensures that the attribute cannot be set to the given values
#
# Options:
@@ -130,6 +141,8 @@ def should_not_allow_values_for(attribute, *bad_values)
end
end
+ # Deprecated: use ActiveRecord::Matchers#allow_value instead.
+ #
# Ensures that the attribute can be set to the given values.
#
# Example:
@@ -143,6 +156,8 @@ def should_allow_values_for(attribute, *good_values)
end
end
+ # Deprecated: use ActiveRecord::Matchers#ensure_length_of instead.
+ #
# Ensures that the length of the attribute is in the given range
#
# Options:
@@ -166,6 +181,8 @@ def should_ensure_length_in_range(attribute, range, opts = {})
with_long_message(long_message)
end
+ # Deprecated: use ActiveRecord::Matchers#ensure_length_of instead.
+ #
# Ensures that the length of the attribute is at least a certain length
#
# Options:
@@ -184,6 +201,8 @@ def should_ensure_length_at_least(attribute, min_length, opts = {})
with_short_message(short_message)
end
+ # Deprecated: use ActiveRecord::Matchers#ensure_length_of instead.
+ #
# Ensures that the length of the attribute is exactly a certain length
#
# Options:
@@ -201,6 +220,8 @@ def should_ensure_length_is(attribute, length, opts = {})
with_message(message)
end
+ # Deprecated: use ActiveRecord::Matchers#ensure_inclusion_of instead.
+ #
# Ensure that the attribute is in the range specified
#
# Options:
@@ -225,6 +246,8 @@ def should_ensure_value_in_range(attribute, range, opts = {})
with_high_message(high_message)
end
+ # Deprecated: use ActiveRecord::Matchers#validate_numericality_of instead.
+ #
# Ensure that the attribute is numeric
#
# Options:
@@ -243,6 +266,8 @@ def should_validate_numericality_of(*attributes)
end
end
+ # Deprecated: use ActiveRecord::Matchers#have_many instead.
+ #
# Ensures that the has_many relationship exists. Will also test that the
# associated table has the required columns. Works with polymorphic
# associations.
@@ -264,6 +289,8 @@ def should_have_many(*associations)
end
end
+ # Deprecated: use ActiveRecord::Matchers#have_one instead.
+ #
# Ensure that the has_one relationship exists. Will also test that the
# associated table has the required columns. Works with polymorphic
# associations.
@@ -282,6 +309,8 @@ def should_have_one(*associations)
end
end
+ # Deprecated: use ActiveRecord::Matchers#have_and_belong_to_many instead.
+ #
# Ensures that the has_and_belongs_to_many relationship exists, and that the join
# table is in place.
#
@@ -296,6 +325,8 @@ def should_have_and_belong_to_many(*associations)
end
end
+ # Deprecated: use ActiveRecord::Matchers#belong_to instead.
+ #
# Ensure that the belongs_to relationship exists.
#
# should_belong_to :parent
@@ -308,6 +339,8 @@ def should_belong_to(*associations)
end
end
+ # Deprecated.
+ #
# Ensure that the given class methods are defined on the model.
#
# should_have_class_methods :find, :destroy
@@ -323,6 +356,8 @@ def should_have_class_methods(*methods)
end
end
+ # Deprecated.
+ #
# Ensure that the given instance methods are defined on the model.
#
# should_have_instance_methods :email, :name, :name=
@@ -338,6 +373,8 @@ def should_have_instance_methods(*methods)
end
end
+ # Deprecated: use ActiveRecord::Matchers#have_db_column instead.
+ #
# Ensure that the given columns are defined on the models backing SQL table.
# Also aliased to should_have_db_column for readability.
# Takes the same options available in migrations:
@@ -367,6 +404,8 @@ def should_have_db_columns(*columns)
alias_method :should_have_db_column, :should_have_db_columns
+ # Deprecated: use ActiveRecord::Matchers#have_db_index instead.
+ #
# Ensures that there are DB indices on the given columns or tuples of columns.
# Also aliased to should_have_db_index for readability
#
@@ -394,6 +433,8 @@ def should_have_db_indices(*columns)
alias_method :should_have_db_index, :should_have_db_indices
+ # Deprecated: use ActiveRecord::Matchers#validate_acceptance_of instead.
+ #
# Ensures that the model cannot be saved if one of the attributes listed is not accepted.
#
# Options:
diff --git a/lib/shoulda/macros.rb b/lib/shoulda/macros.rb
index 394fd31a..b8ea4c4a 100644
--- a/lib/shoulda/macros.rb
+++ b/lib/shoulda/macros.rb
@@ -2,6 +2,8 @@
module Shoulda # :nodoc:
module Macros
+ # Deprecated.
+ #
# Macro that creates a test asserting a change between the return value
# of a block that is run before and after the current setup block
# is run. This is similar to Active Support's assert_difference
@@ -53,6 +55,8 @@ def should_change(description, options = {}, &block)
end
end
+ # Deprecated.
+ #
# Macro that creates a test asserting no change between the return value
# of a block that is run before and after the current setup block
# is run. This is the logical opposite of should_change.
@@ -74,6 +78,8 @@ def should_not_change(description, &block)
end
end
+ # Deprecated.
+ #
# Macro that creates a test asserting that a record of the given class was
# created.
#
@@ -88,6 +94,8 @@ def should_create(class_name)
should_change_record_count_of(class_name, 1, 'create')
end
+ # Deprecated.
+ #
# Macro that creates a test asserting that a record of the given class was
# destroyed.
#