提交 2d84f24a 编写于 作者: A Anil Wadghule 提交者: José Valim

Add tests for convenience methods #notice and #alert to flash.now [#4369 state:resolved]

Signed-off-by: NJosé Valim <jose.valim@gmail.com>
上级 e807476d
......@@ -81,6 +81,16 @@ def redirect_with_notice
redirect_to '/somewhere', :notice => "Good luck in the somewheres!"
end
def render_with_flash_now_alert
flash.now.alert = "Beware the nowheres now!"
render :inline => "hello"
end
def render_with_flash_now_notice
flash.now.notice = "Good luck in the somewheres now!"
render :inline => "hello"
end
def redirect_with_other_flashes
redirect_to '/wonderland', :flash => { :joyride => "Horses!" }
end
......@@ -183,6 +193,16 @@ def test_redirect_to_with_notice
assert_equal "Good luck in the somewheres!", @controller.send(:flash)[:notice]
end
def test_render_with_flash_now_alert
get :render_with_flash_now_alert
assert_equal "Beware the nowheres now!", @controller.send(:flash)[:alert]
end
def test_render_with_flash_now_notice
get :render_with_flash_now_notice
assert_equal "Good luck in the somewheres now!", @controller.send(:flash)[:notice]
end
def test_redirect_to_with_other_flashes
get :redirect_with_other_flashes
assert_equal "Horses!", @controller.send(:flash)[:joyride]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册