ruby on rails - Why are these tests not working? -
i ran problem , found this answer believe solve problem, can't work.
here's code:
setup # hell put def main_app rails.application.class.routes.url_helpers end @routes = engine.routes end test "should index" :index assert_response :success end
blaine@vm:~/sizzle-chisel$ rake test started run options --seed 60111 error["test_should_get_index", blog::admin::articlescontrollertest, 0.3109516409999742] test_should_get_index#blog::admin::articlescontrollertest (0.31s) actionview::template::error: actionview::template::error: undefined method `root_path' #<actiondispatch::routing:: routesproxy:0x00000006eda278>
blog::engine.routes.draw root "articles#index" resources :articles namespace :admin resources :articles root to: 'articles#index' end end
i keep getting root_path undefined, because within layout, there's code:
<%= link_to "some link", main_app.root_path %>
my codebase rails engine... when run rake test, there no root_path defined on main_app.
first, can remove setup block.
and try with:
test "should index" '/' assert_response :success end
root "articles#index"
maps root
(http://mywebsite.com) of website action index
on articles
controller.
Comments
Post a Comment