The solution is like following code:
test/units/foo_helper_test.rb:
...
class FooTestController < ActionController::Base
...
def index
render :inline => <<-INLINE
<% foo do %>
<%= ... %>
<% end %>
INLINE
end
end
class FooHelperTest < Test::Unit::TestCase
def setup
@controller = FooTestController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
def test_foo
get :index
# do assert_select or whatever you like, to check rendering result of the helper.
end
end
1 comment:
If you have problem about "nil.rewrite" Fix nil.rewrite errors in your Helper Tests may save you. Thanks for the information, Junya.
Post a Comment