Namespace
Methods
T
Instance Public methods
test_does_not_set_the_session_if_the_flash_is_empty()
# File actionpack/test/controller/flash_test.rb, line 155
def test_does_not_set_the_session_if_the_flash_is_empty
  get :std_action
  assert_nil session["flash"]
end
test_flash()
# File actionpack/test/controller/flash_test.rb, line 101
def test_flash
  get :set_flash

  get :use_flash
  assert_equal "hello", assigns["flash_copy"]["that"]
  assert_equal "hello", assigns["flashy"]

  get :use_flash
  assert_nil assigns["flash_copy"]["that"], "On second flash"
end
test_flash_after_reset_session()
# File actionpack/test/controller/flash_test.rb, line 148
def test_flash_after_reset_session
  get :use_flash_after_reset_session
  assert_equal "hello",    assigns["flashy_that"]
  assert_equal "good-bye", assigns["flashy_this"]
  assert_nil   assigns["flashy_that_reset"]
end
test_flash_now()
# File actionpack/test/controller/flash_test.rb, line 126
def test_flash_now
  get :set_flash_now
  assert_equal "hello", assigns["flash_copy"]["that"]
  assert_equal "bar"  , assigns["flash_copy"]["foo"]
  assert_equal "hello", assigns["flashy"]

  get :attempt_to_use_flash_now
  assert_nil assigns["flash_copy"]["that"]
  assert_nil assigns["flash_copy"]["foo"]
  assert_nil assigns["flashy"]
end
test_keep_and_discard_return_values()
# File actionpack/test/controller/flash_test.rb, line 171
def test_keep_and_discard_return_values
  flash = ActionDispatch::Flash::FlashHash.new
  flash.update(:foo => :foo_indeed, :bar => :bar_indeed)

  assert_equal(:foo_indeed, flash.discard(:foo)) # valid key passed
  assert_nil flash.discard(:unknown) # non existant key passed
  assert_equal({:foo => :foo_indeed, :bar => :bar_indeed}, flash.discard().to_hash) # nothing passed
  assert_equal({:foo => :foo_indeed, :bar => :bar_indeed}, flash.discard(nil).to_hash) # nothing passed

  assert_equal(:foo_indeed, flash.keep(:foo)) # valid key passed
  assert_nil flash.keep(:unknown) # non existant key passed
  assert_equal({:foo => :foo_indeed, :bar => :bar_indeed}, flash.keep().to_hash) # nothing passed
  assert_equal({:foo => :foo_indeed, :bar => :bar_indeed}, flash.keep(nil).to_hash) # nothing passed
end
test_keep_flash()
# File actionpack/test/controller/flash_test.rb, line 112
def test_keep_flash
  get :set_flash

  get :use_flash_and_keep_it
  assert_equal "hello", assigns["flash_copy"]["that"]
  assert_equal "hello", assigns["flashy"]

  get :use_flash
  assert_equal "hello", assigns["flash_copy"]["that"], "On second flash"

  get :use_flash
  assert_nil assigns["flash_copy"]["that"], "On third flash"
end
test_redirect_to_with_alert()
# File actionpack/test/controller/flash_test.rb, line 186
def test_redirect_to_with_alert
  get :redirect_with_alert
  assert_equal "Beware the nowheres!", @controller.send(:flash)[:alert]
end
test_redirect_to_with_notice()
# File actionpack/test/controller/flash_test.rb, line 191
def test_redirect_to_with_notice
  get :redirect_with_notice
  assert_equal "Good luck in the somewheres!", @controller.send(:flash)[:notice]
end
test_redirect_to_with_other_flashes()
# File actionpack/test/controller/flash_test.rb, line 206
def test_redirect_to_with_other_flashes
  get :redirect_with_other_flashes
  assert_equal "Horses!", @controller.send(:flash)[:joyride]
end
test_render_with_flash_now_alert()
# File actionpack/test/controller/flash_test.rb, line 196
def test_render_with_flash_now_alert
  get :render_with_flash_now_alert
  assert_equal "Beware the nowheres now!", @controller.send(:flash)[:alert]
end
test_render_with_flash_now_notice()
# File actionpack/test/controller/flash_test.rb, line 201
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
test_sweep_after_halted_filter_chain()
# File actionpack/test/controller/flash_test.rb, line 160
def test_sweep_after_halted_filter_chain
  get :std_action
  assert_nil assigns["flash_copy"]["foo"]
  get :filter_halting_action
  assert_equal "bar", assigns["flash_copy"]["foo"]
  get :std_action # follow redirection
  assert_equal "bar", assigns["flash_copy"]["foo"]
  get :std_action
  assert_nil assigns["flash_copy"]["foo"]
end
test_update_flash()
# File actionpack/test/controller/flash_test.rb, line 138
def test_update_flash
  get :set_flash
  get :use_flash_and_update_it
  assert_equal "hello",       assigns["flash_copy"]["that"]
  assert_equal "hello again", assigns["flash_copy"]["this"]
  get :use_flash
  assert_nil                  assigns["flash_copy"]["that"], "On second flash"
  assert_equal "hello again", assigns["flash_copy"]["this"], "On second flash"
end