test/flash_responder_test.rb in responders-0.5.3 vs test/flash_responder_test.rb in responders-0.5.4

- old
+ new

@@ -16,11 +16,11 @@ class AddressesController < ApplicationController before_filter :set_resource self.responder = FlashResponder def action - options = params.slice(:flash) + options = params.slice(:flash, :flash_now) flash[:success] = "Flash is set" if params[:set_flash] respond_with(@resource, options) end alias :new :action alias :create :action @@ -103,9 +103,16 @@ end def test_sets_flash_message_even_if_block_is_given post :with_block assert_equal "Resource with block created with success", flash[:success] + end + + def test_sets_flash_message_can_be_set_to_now + @now = {} + @controller.flash.expects(:now).returns(@now) + post :create, :flash_now => true + assert_equal "Resource created with success", @now[:success] end def test_sets_message_based_on_notice_key Responders::FlashResponder.flash_keys = [ :notice, :alert ] post :another \ No newline at end of file