test/flash_responder_test.rb in responders-0.4.6 vs test/flash_responder_test.rb in responders-0.4.7

- old
+ new

@@ -14,10 +14,11 @@ end class AddressesController < ApplicationController before_filter :set_resource self.responder = FlashResponder + respond_to :js, :only => :create def action options = params.slice(:flash, :flash_now) flash[:success] = "Flash is set" if params[:set_flash] respond_with(@resource, options) @@ -103,9 +104,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_now_flash_message_on_javascript_requests + @now = {} + @controller.flash.expects(:now).returns(@now) + post :create, :format => :js + assert_equal "Resource created with success", @now[:success] end def test_sets_flash_message_can_be_set_to_now @now = {} @controller.flash.expects(:now).returns(@now) \ No newline at end of file