Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 5358

Show
Ignore:
Timestamp:
10/24/06 17:14:50 (2 years ago)
Author:
minam
Message:

Use new deprecate syntax so that alternatives are given with the warning

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/assertions/deprecated_assertions.rb

    r4962 r5358  
    77        assert_response(:success, message) 
    88      end 
    9       deprecate :assert_success 
     9      deprecate :assert_success => "use assert_response(:success)" 
    1010 
    1111      def assert_redirect(message=nil) #:nodoc: 
    1212        assert_response(:redirect, message) 
    1313      end 
    14       deprecate :assert_redirect 
     14      deprecate :assert_redirect => "use assert_response(:redirect)" 
    1515 
    1616      def assert_rendered_file(expected=nil, message=nil) #:nodoc: 
    1717        assert_template(expected, message) 
    1818      end 
    19       deprecate :assert_rendered_file 
     19      deprecate :assert_rendered_file => :assert_template 
    2020 
    2121      # ensure that the session has an object with the specified name 
     
    2424        assert_block(msg) { @response.has_session_object?(key) } 
    2525      end 
    26       deprecate :assert_session_has 
     26      deprecate :assert_session_has => "use assert(@response.has_session_object?(key))" 
    2727 
    2828      # ensure that the session has no object with the specified name 
     
    3131        assert_block(msg) { !@response.has_session_object?(key) } 
    3232      end 
    33       deprecate :assert_session_has_no 
     33      deprecate :assert_session_has_no => "use assert(!@response.has_session_object?(key))" 
    3434 
    3535      def assert_session_equal(expected = nil, key = nil, message = nil) #:nodoc: 
     
    3737        assert_block(msg) { expected == @response.session[key] } 
    3838      end 
    39       deprecate :assert_session_equal 
     39      deprecate :assert_session_equal => "use assert_equal(expected, @response[key])" 
    4040 
    4141      # -- cookie assertions --------------------------------------------------- 
     
    4646        assert_block(msg) { actual.nil? or actual.empty? } 
    4747      end 
    48       deprecate :assert_no_cookie 
     48      deprecate :assert_no_cookie => "use assert(!@response.cookies.key?(key))" 
    4949     
    5050      def assert_cookie_equal(expected = nil, key = nil, message = nil) #:nodoc: 
     
    5454        assert_block(msg) { expected == actual } 
    5555      end 
    56       deprecate :assert_cookie_equal 
     56      deprecate :assert_cookie_equal => "use assert(@response.cookies.key?(key))" 
    5757     
    5858      # -- flash assertions --------------------------------------------------- 
     
    6363        assert_block(msg) { @response.has_flash_object?(key) } 
    6464      end 
    65       deprecate :assert_flash_has 
     65      deprecate :assert_flash_has => "use assert(@response.has_flash_object?(key))" 
    6666 
    6767      # ensure that the flash has no object with the specified name 
     
    7070        assert_block(msg) { !@response.has_flash_object?(key) } 
    7171      end 
    72       deprecate :assert_flash_has_no 
     72      deprecate :assert_flash_has_no => "use assert(!@response.has_flash_object?(key))" 
    7373 
    7474      # ensure the flash exists 
     
    7777        assert_block(msg) { @response.has_flash? } 
    7878      end 
    79       deprecate :assert_flash_exists 
     79      deprecate :assert_flash_exists => "use assert(@response.has_flash?)" 
    8080 
    8181      # ensure the flash does not exist 
     
    8484        assert_block(msg) { !@response.has_flash? } 
    8585      end 
    86       deprecate :assert_flash_not_exists 
     86      deprecate :assert_flash_not_exists => "use assert(!@response.has_flash?)" 
    8787     
    8888      # ensure the flash is empty but existent 
     
    9191        assert_block(msg) { !@response.has_flash_with_contents? } 
    9292      end 
    93       deprecate :assert_flash_empty 
     93      deprecate :assert_flash_empty => "use assert(!@response.has_flash_with_contents?)" 
    9494 
    9595      # ensure the flash is not empty 
     
    9898        assert_block(msg) { @response.has_flash_with_contents? } 
    9999      end 
    100       deprecate :assert_flash_not_empty 
     100      deprecate :assert_flash_not_empty => "use assert(@response.has_flash_with_contents?)" 
    101101     
    102102      def assert_flash_equal(expected = nil, key = nil, message = nil) #:nodoc: 
     
    104104        assert_block(msg) { expected == @response.flash[key] } 
    105105      end 
    106       deprecate :assert_flash_equal 
     106      deprecate :assert_flash_equal => "use assert_equal(expected, @response.flash[key])" 
    107107     
    108108 
     
    113113        assert_block(msg) { @response.redirect_url == url } 
    114114      end 
    115       deprecate :assert_redirect_url 
     115      deprecate :assert_redirect_url => "use assert_equal(url, @response.redirect_url)" 
    116116 
    117117      # ensure our redirection url matches a pattern 
     
    121121        assert_block(msg) { @response.redirect_url_match?(pattern) } 
    122122      end 
    123       deprecate :assert_redirect_url_match 
     123      deprecate :assert_redirect_url_match => "use assert(@response.redirect_url_match?(pattern))" 
    124124 
    125125     
     
    131131        assert_block(msg) { @response.has_template_object?(key) } 
    132132      end 
    133       deprecate :assert_template_has 
     133      deprecate :assert_template_has => "use assert(@response.has_template_object?(key))" 
    134134 
    135135      # ensure that a template object with the given name does not exist 
     
    138138        assert_block(msg) { !@response.has_template_object?(key) } 
    139139      end 
    140       deprecate :assert_template_has_no 
     140      deprecate :assert_template_has_no => "use assert(!@response.has_template_object?(key))" 
    141141 
    142142      # ensures that the object assigned to the template on +key+ is equal to +expected+ object. 
     
    146146      end 
    147147      alias_method :assert_assigned_equal, :assert_template_equal 
    148       deprecate :assert_assigned_equal 
    149       deprecate :assert_template_equal 
     148      deprecate :assert_assigned_equal => "use assert_equal(expected, @response.template.assigns[key.to_s])" 
     149      deprecate :assert_template_equal => "use assert_equal(expected, @response.template.assigns[key.to_s])" 
    150150 
    151151      # Asserts that the template returns the +expected+ string or array based on the XPath +expression+. 
     
    165165        assert_block(msg) { matches == expected } 
    166166      end 
    167       deprecate :assert_template_xpath_match 
     167      deprecate :assert_template_xpath_match => "you should use assert_tag, instead" 
    168168 
    169169      # Assert the template object with the given name is an Active Record descendant and is valid. 
     
    173173        assert_block(msg) { record.valid? } 
    174174      end 
    175       deprecate :assert_valid_record 
     175      deprecate :assert_valid_record => "use assert(assigns(key).valid?)" 
    176176 
    177177      # Assert the template object with the given name is an Active Record descendant and is invalid. 
     
    181181        assert_block(msg) { !record.valid? } 
    182182      end 
    183       deprecate :assert_invalid_record 
     183      deprecate :assert_invalid_record => "use assert(!assigns(key).valid?)" 
    184184 
    185185      # Assert the template object with the given name is an Active Record descendant and the specified column(s) are valid. 
     
    193193        assert_block(msg) { cols.empty? } 
    194194      end 
    195       deprecate :assert_valid_column_on_record 
     195      deprecate :assert_valid_column_on_record => "use assert(!record.errors.invalid?(column)) instead" 
    196196 
    197197      # Assert the template object with the given name is an Active Record descendant and the specified column(s) are invalid. 
     
    205205        assert_block(msg) { cols.empty? } 
    206206      end 
    207       deprecate :assert_invalid_column_on_record 
     207      deprecate :assert_invalid_column_on_record => "use assert(record.errors.invalid?(column)) instead" 
    208208 
    209209      private 
  • trunk/actionpack/lib/action_view/helpers/form_tag_helper.rb

    r5347 r5358  
    6565      end 
    6666       
    67       deprecate :end_form_tag, :start_form_tag 
     67      deprecate :end_form_tag, :start_form_tag => :form_tag 
    6868 
    6969      # Creates a dropdown selection box, or if the <tt>:multiple</tt> option is set to true, a multiple 
  • trunk/actionpack/lib/action_view/helpers/number_helper.rb

    r5336 r5358  
    150150       
    151151      alias_method :human_size, :number_to_human_size # deprecated alias 
    152       deprecate :human_size 
     152      deprecate :human_size => :number_to_human_size 
    153153    end 
    154154  end 
  • trunk/actionpack/lib/action_view/helpers/url_helper.rb

    r5338 r5358  
    175175 
    176176      alias_method :link_to_image, :link_image_to 
    177       deprecate :link_image_to 
     177      deprecate :link_image_to => :link_to_image 
    178178 
    179179      # Creates a link tag of the given +name+ using a URL created by the set of