code_junkie

How do I test helpers in Rails?

Nov 13th, 2011
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. require File.dirname(__FILE__) + '/../spec_helper'
  2.  
  3. describe FoosHelper do
  4.  
  5. it "should do something" do
  6. helper.some_helper_method.should == @something
  7. end
  8.  
  9. end
  10.  
  11. require 'test_helper'
  12.  
  13. class YourHelperTest < ActionView::TestCase
  14. test "should work" do
  15. assert_equal "result", your_helper_method
  16. end
  17. end
  18.  
  19. require File.dirname(__FILE__) + ‘/../test_helper’
  20. require ‘user_helper’
  21.  
  22. class UserHelperTest < Test::Unit::TestCase
  23.  
  24. include UserHelper
  25.  
  26. def test_a_user_helper_method_here
  27. end
  28.  
  29. end
  30.  
  31. require File.dirname(__FILE__) + '/../spec_helper'
  32.  
  33. describe FoosHelper do
  34.  
  35. it "should do something" do
  36. helper.some_helper_method.should == @something
  37. end
  38.  
  39. end
Add Comment
Please, Sign In to add comment