Sha256: 9b6795ee286bdf75b6feef360612931455f44f5ca13d71f7699e2eb303d29238
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
# encoding: utf-8 require 'spec_helper' require 'htmlentities' ActionDispatch::Flash::FlashHash.class_eval do def discard?(key); @used.include?(key); end def keep?(key); !discard?(key); end end describe FlashController do it "should display flash message on redirect" do post :redirect, type: :notice, message: 'Glow!' flash[:notice].should be == 'Glow!' flash.keep?(:notice).should be true end it "should display flash message on xhr" do xhr :get, :ajax, type: :notice, message: 'Glow!' flash[:notice].should be == 'Glow!' flash.discard?(:notice).should be true @response.headers['X-Message-Type'].should be == 'notice' HTMLEntities.new.decode(@response.headers['X-Message']).should be == 'Glow!' end it "should handle unicode on xhr" do xhr :get, :ajax, type: :notice, message: 'utf8: ✓' @response.headers['X-Message-Type'].should be == 'notice' HTMLEntities.new.decode(@response.headers['X-Message']).should be == 'utf8: ✓' end it "should not display flash message on xhr when skip_glow is set" do xhr :get, :ajax, type: :notice, message: 'utf8: ✓', skip_glow: true @response.headers.should_not have_key 'X-Message-Type' end end
Version data entries
3 entries across 1 versions & 1 rubygems