code_junkie

How do I test Rails block helpers with rSpec

Nov 11th, 2011
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <% some_block_helper do %>
  2. Some arbitrary HTML and ERB variables here.
  3. More HTML here.
  4. <% end %>
  5.  
  6. describe SomeHelper do
  7. it 'should do something' do
  8. helper.some_block_helper { the_block_code }.should XXXX
  9. end
  10. end
  11.  
  12. describe SomeHelper do
  13. it 'should do something' do
  14. content = lambda { "blah" }
  15. result = helper.some_block_helper(&content)
  16.  
  17. result.should include("blah")
  18. result.should XXX
  19. end
  20. end
Add Comment
Please, Sign In to add comment