From dd055510b4f0453c0f70dddf7af23c6b7cb77139 Mon Sep 17 00:00:00 2001 From: choonkeat Date: Wed, 5 Nov 2014 12:43:00 +0800 Subject: [PATCH] Fix #winston/rails_utils/7 do not render flash[:timedout] --- lib/rails_utils.rb | 1 + test/rails_utils_test.rb | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/rails_utils.rb b/lib/rails_utils.rb index bbac10c..2e8ac72 100644 --- a/lib/rails_utils.rb +++ b/lib/rails_utils.rb @@ -36,6 +36,7 @@ def javascript_initialization def flash_messages(options = {}) flash.collect do |key, message| next if message.blank? + next if key.to_s == 'timedout' content_tag(:div, content_tag(:button, options[:button_html] || "x", type: "button", class: options[:button_class] || "close", "data-dismiss" => "alert") + message, class: "#{flash_class(key)} fade in #{options[:class]}") end.join("\n").html_safe diff --git a/test/rails_utils_test.rb b/test/rails_utils_test.rb index 0f7240d..6c69a01 100644 --- a/test/rails_utils_test.rb +++ b/test/rails_utils_test.rb @@ -206,5 +206,10 @@ def set_flash(key, message) end end + it "should skip flash[:timedout]" do + set_flash :timedout, "not important" + view.flash_messages.must_equal "" + end + end end