Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Can't use ERBUtil methods in helper specs #597
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
dchelimsky
Aug 11, 2012
Owner
RSpec's helper specs wrap Rails' helper tests. This would make more sense to fix there, so please submit this to the Rails issue tracker.
FYI if you do - Rails' helper specs work a bit differently - instead of exposing a helper object, they include the helper module right in the test so your example would look like this:
assert_equal link_to(html_escape("<b>hello</b>")), link_to_custom("<b>hello</b>")
RSpec's helper specs wrap Rails' helper tests. This would make more sense to fix there, so please submit this to the Rails issue tracker. FYI if you do - Rails' helper specs work a bit differently - instead of exposing a helper object, they include the helper module right in the test so your example would look like this: assert_equal link_to(html_escape("<b>hello</b>")), link_to_custom("<b>hello</b>") |
dchelimsky
closed this
Aug 11, 2012
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
ngan
commented
Aug 11, 2012
Thanks David! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment Hide comment
ngan
Aug 11, 2012
Hey David, rails doesn't include it into TestCase--as for the reason, I'm not really clear. And I'm not sure if they even consider it a bug.
In any case, now that I think about it, perhaps rspec should fix this "issue.". Rspec takes the extra mile and does the right thing by giving you a helper
method that encapsulates the helper scope. To the rspec user, there's no knowledge that the helper inherits from rails TestCase, and they shouldn't. Rspec-rails promises the entire helper context inside helper
and it should fix what rails TestCase lacks.
Just my opinion. Thanks!
ngan
commented
Aug 11, 2012
Hey David, rails doesn't include it into TestCase--as for the reason, I'm not really clear. And I'm not sure if they even consider it a bug. In any case, now that I think about it, perhaps rspec should fix this "issue.". Rspec takes the extra mile and does the right thing by giving you a Just my opinion. Thanks! |
ngan commentedAug 10, 2012
I can't seem to use ERBUtils methods like
h
orhtml_escape
inside my helper specs.For exampe....
This will raise undefined method for html_escape.