diff options
author | Jamis Buck <jamis@37signals.com> | 2006-10-24 17:14:50 +0000 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2006-10-24 17:14:50 +0000 |
commit | 897ffd63d2ee33808eb68173409bcf1047930535 (patch) | |
tree | d1e128f4dad00d416579a7d7ad7a85fa3ada428a | |
parent | 3a318970b19129c2ba57ebf576015dfa653613e8 (diff) | |
download | rails-897ffd63d2ee33808eb68173409bcf1047930535.tar.gz rails-897ffd63d2ee33808eb68173409bcf1047930535.tar.bz2 rails-897ffd63d2ee33808eb68173409bcf1047930535.zip |
Use new deprecate syntax so that alternatives are given with the warning
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5358 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
4 files changed, 29 insertions, 29 deletions
diff --git a/actionpack/lib/action_controller/assertions/deprecated_assertions.rb b/actionpack/lib/action_controller/assertions/deprecated_assertions.rb index c7d2eec66c..1bafbd1bc8 100644 --- a/actionpack/lib/action_controller/assertions/deprecated_assertions.rb +++ b/actionpack/lib/action_controller/assertions/deprecated_assertions.rb @@ -6,37 +6,37 @@ module ActionController #:nodoc: def assert_success(message=nil) #:nodoc: assert_response(:success, message) end - deprecate :assert_success + deprecate :assert_success => "use assert_response(:success)" def assert_redirect(message=nil) #:nodoc: assert_response(:redirect, message) end - deprecate :assert_redirect + deprecate :assert_redirect => "use assert_response(:redirect)" def assert_rendered_file(expected=nil, message=nil) #:nodoc: assert_template(expected, message) end - deprecate :assert_rendered_file + deprecate :assert_rendered_file => :assert_template # ensure that the session has an object with the specified name def assert_session_has(key=nil, message=nil) #:nodoc: msg = build_message(message, "<?> is not in the session <?>", key, @response.session) assert_block(msg) { @response.has_session_object?(key) } end - deprecate :assert_session_has + deprecate :assert_session_has => "use assert(@response.has_session_object?(key))" # ensure that the session has no object with the specified name def assert_session_has_no(key=nil, message=nil) #:nodoc: msg = build_message(message, "<?> is in the session <?>", key, @response.session) assert_block(msg) { !@response.has_session_object?(key) } end - deprecate :assert_session_has_no + deprecate :assert_session_has_no => "use assert(!@response.has_session_object?(key))" def assert_session_equal(expected = nil, key = nil, message = nil) #:nodoc: msg = build_message(message, "<?> expected in session['?'] but was <?>", expected, key, @response.session[key]) assert_block(msg) { expected == @response.session[key] } end - deprecate :assert_session_equal + deprecate :assert_session_equal => "use assert_equal(expected, @response[key])" # -- cookie assertions --------------------------------------------------- @@ -45,7 +45,7 @@ module ActionController #:nodoc: msg = build_message(message, "<?> not expected in cookies['?']", actual, key) assert_block(msg) { actual.nil? or actual.empty? } end - deprecate :assert_no_cookie + deprecate :assert_no_cookie => "use assert(!@response.cookies.key?(key))" def assert_cookie_equal(expected = nil, key = nil, message = nil) #:nodoc: actual = @response.cookies[key] @@ -53,7 +53,7 @@ module ActionController #:nodoc: msg = build_message(message, "<?> expected in cookies['?'] but was <?>", expected, key, actual) assert_block(msg) { expected == actual } end - deprecate :assert_cookie_equal + deprecate :assert_cookie_equal => "use assert(@response.cookies.key?(key))" # -- flash assertions --------------------------------------------------- @@ -62,48 +62,48 @@ module ActionController #:nodoc: msg = build_message(message, "<?> is not in the flash <?>", key, @response.flash) assert_block(msg) { @response.has_flash_object?(key) } end - deprecate :assert_flash_has + deprecate :assert_flash_has => "use assert(@response.has_flash_object?(key))" # ensure that the flash has no object with the specified name def assert_flash_has_no(key=nil, message=nil) #:nodoc: msg = build_message(message, "<?> is in the flash <?>", key, @response.flash) assert_block(msg) { !@response.has_flash_object?(key) } end - deprecate :assert_flash_has_no + deprecate :assert_flash_has_no => "use assert(!@response.has_flash_object?(key))" # ensure the flash exists def assert_flash_exists(message=nil) #:nodoc: msg = build_message(message, "the flash does not exist <?>", @response.session['flash'] ) assert_block(msg) { @response.has_flash? } end - deprecate :assert_flash_exists + deprecate :assert_flash_exists => "use assert(@response.has_flash?)" # ensure the flash does not exist def assert_flash_not_exists(message=nil) #:nodoc: msg = build_message(message, "the flash exists <?>", @response.flash) assert_block(msg) { !@response.has_flash? } end - deprecate :assert_flash_not_exists + deprecate :assert_flash_not_exists => "use assert(!@response.has_flash?)" # ensure the flash is empty but existent def assert_flash_empty(message=nil) #:nodoc: msg = build_message(message, "the flash is not empty <?>", @response.flash) assert_block(msg) { !@response.has_flash_with_contents? } end - deprecate :assert_flash_empty + deprecate :assert_flash_empty => "use assert(!@response.has_flash_with_contents?)" # ensure the flash is not empty def assert_flash_not_empty(message=nil) #:nodoc: msg = build_message(message, "the flash is empty") assert_block(msg) { @response.has_flash_with_contents? } end - deprecate :assert_flash_not_empty + deprecate :assert_flash_not_empty => "use assert(@response.has_flash_with_contents?)" def assert_flash_equal(expected = nil, key = nil, message = nil) #:nodoc: msg = build_message(message, "<?> expected in flash['?'] but was <?>", expected, key, @response.flash[key]) assert_block(msg) { expected == @response.flash[key] } end - deprecate :assert_flash_equal + deprecate :assert_flash_equal => "use assert_equal(expected, @response.flash[key])" # ensure our redirection url is an exact match @@ -112,7 +112,7 @@ module ActionController #:nodoc: msg = build_message(message, "<?> is not the redirected location <?>", url, @response.redirect_url) assert_block(msg) { @response.redirect_url == url } end - deprecate :assert_redirect_url + deprecate :assert_redirect_url => "use assert_equal(url, @response.redirect_url)" # ensure our redirection url matches a pattern def assert_redirect_url_match(pattern=nil, message=nil) #:nodoc: @@ -120,7 +120,7 @@ module ActionController #:nodoc: msg = build_message(message, "<?> was not found in the location: <?>", pattern, @response.redirect_url) assert_block(msg) { @response.redirect_url_match?(pattern) } end - deprecate :assert_redirect_url_match + deprecate :assert_redirect_url_match => "use assert(@response.redirect_url_match?(pattern))" # -- template assertions ------------------------------------------------ @@ -130,14 +130,14 @@ module ActionController #:nodoc: msg = build_message(message, "<?> is not a template object", key ) assert_block(msg) { @response.has_template_object?(key) } end - deprecate :assert_template_has + deprecate :assert_template_has => "use assert(@response.has_template_object?(key))" # ensure that a template object with the given name does not exist def assert_template_has_no(key=nil,message=nil) #:nodoc: msg = build_message(message, "<?> is a template object <?>", key, @response.template_objects[key]) assert_block(msg) { !@response.has_template_object?(key) } end - deprecate :assert_template_has_no + deprecate :assert_template_has_no => "use assert(!@response.has_template_object?(key))" # ensures that the object assigned to the template on +key+ is equal to +expected+ object. def assert_template_equal(expected = nil, key = nil, message = nil) #:nodoc: @@ -145,8 +145,8 @@ module ActionController #:nodoc: assert_block(msg) { expected == @response.template.assigns[key.to_s] } end alias_method :assert_assigned_equal, :assert_template_equal - deprecate :assert_assigned_equal - deprecate :assert_template_equal + deprecate :assert_assigned_equal => "use assert_equal(expected, @response.template.assigns[key.to_s])" + deprecate :assert_template_equal => "use assert_equal(expected, @response.template.assigns[key.to_s])" # Asserts that the template returns the +expected+ string or array based on the XPath +expression+. # This will only work if the template rendered a valid XML document. @@ -164,7 +164,7 @@ module ActionController #:nodoc: msg = build_message(message, "<?> found <?>, not <?>", expression, matches, expected) assert_block(msg) { matches == expected } end - deprecate :assert_template_xpath_match + deprecate :assert_template_xpath_match => "you should use assert_tag, instead" # Assert the template object with the given name is an Active Record descendant and is valid. def assert_valid_record(key = nil, message = nil) #:nodoc: @@ -172,7 +172,7 @@ module ActionController #:nodoc: msg = build_message(message, "Active Record is invalid <?>)", record.errors.full_messages) assert_block(msg) { record.valid? } end - deprecate :assert_valid_record + deprecate :assert_valid_record => "use assert(assigns(key).valid?)" # Assert the template object with the given name is an Active Record descendant and is invalid. def assert_invalid_record(key = nil, message = nil) #:nodoc: @@ -180,7 +180,7 @@ module ActionController #:nodoc: msg = build_message(message, "Active Record is valid)") assert_block(msg) { !record.valid? } end - deprecate :assert_invalid_record + deprecate :assert_invalid_record => "use assert(!assigns(key).valid?)" # Assert the template object with the given name is an Active Record descendant and the specified column(s) are valid. def assert_valid_column_on_record(key = nil, columns = "", message = nil) #:nodoc: @@ -192,7 +192,7 @@ module ActionController #:nodoc: msg = build_message(message, "Active Record has invalid columns <?>)", cols.join(",") ) assert_block(msg) { cols.empty? } end - deprecate :assert_valid_column_on_record + deprecate :assert_valid_column_on_record => "use assert(!record.errors.invalid?(column)) instead" # Assert the template object with the given name is an Active Record descendant and the specified column(s) are invalid. def assert_invalid_column_on_record(key = nil, columns = "", message = nil) #:nodoc: @@ -204,7 +204,7 @@ module ActionController #:nodoc: msg = build_message(message, "Active Record has valid columns <?>)", cols.join(",") ) assert_block(msg) { cols.empty? } end - deprecate :assert_invalid_column_on_record + deprecate :assert_invalid_column_on_record => "use assert(record.errors.invalid?(column)) instead" private def glue_columns(columns) diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index d67a5c6f41..e2e796e7c8 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -64,7 +64,7 @@ module ActionView "</form>" end - deprecate :end_form_tag, :start_form_tag + deprecate :end_form_tag, :start_form_tag => :form_tag # Creates a dropdown selection box, or if the <tt>:multiple</tt> option is set to true, a multiple # choice selection box. diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index 3dfcbbdccb..979ba03f0c 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -149,7 +149,7 @@ module ActionView end alias_method :human_size, :number_to_human_size # deprecated alias - deprecate :human_size + deprecate :human_size => :number_to_human_size end end end diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index d78deb0b5a..009f5f5f45 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -174,7 +174,7 @@ module ActionView end alias_method :link_to_image, :link_image_to - deprecate :link_image_to + deprecate :link_image_to => :link_to_image # Creates a link tag of the given +name+ using a URL created by the set of # +options+ unless the current request uri is the same as the links, in |