Displaying 2 results from an estimated 2 matches for "some_private_method".
2007 Dec 05
4
render :update and controller private methods
...robably asked and answered, but...
Why are controller private methods inaccessible inside the block
passed to render :update ?
This does not work:
class MyController < ApplicationController
def some_action
render :update do |page|
page.replace_html ''an_element'', some_private_method
end
end
private
def some_private_method
return ''data''
end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email...
2009 Oct 14
14
spec-ing private methods?
...d + other_complex_methods
> end
>
> private
> def complex_method...
> def?other_complex_methods ...
>
> and the two complex methods can get really tricky to get right, I would like
> to be able to write specs for them, how do you do that? I mean I cannot do:
>
> object.some_private_method
>
> You have a few options:
> 1. Make the method public in the object you are testing
> 2. Make the method public in the test case
> 3. Don''t test the method
> 4. Use __send__ or (send) to call it.
> 5. Refactor private methods to a new object, and make the methods pub...