code_junkie

How to test with RSpec a Rails plugin using “link_to” and “current_page?”

Nov 11th, 2011
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. def menu(options = {}, &block)
  2. carte = my_menu.new(self)
  3. yield carte
  4. carte.to_s unless carte.empty?
  5. end
  6.  
  7. class my_menu
  8. include ActionView::Helpers::TagHelper
  9. include ActionView::Helpers::UrlHelper
  10.  
  11. def initialize(base)
  12. @base = base
  13. end
  14.  
  15. def link
  16. @base.link_to(name, url_options, html_options)
  17. @base.current_page?(url_options)
  18. end
  19. end
  20.  
  21. included ActionView::Helpers::UrlHelper
Add Comment
Please, Sign In to add comment