diff --git a/app/helpers/errs_helper.rb b/app/helpers/errs_helper.rb index 3a8ca84..84d5df4 100644 --- a/app/helpers/errs_helper.rb +++ b/app/helpers/errs_helper.rb @@ -8,9 +8,10 @@ module ErrsHelper end def trucated_err_message(problem) - msg = truncate(problem.message, :length => 300) - # Insert invisible unicode characters so that firefox can emulate 'word-wrap: break-word' CSS - msg.scan(/.{1,5}/).join("​").html_safe + unless (msg = problem.message).blank? + # Truncate & insert invisible chars so that firefox can emulate 'word-wrap: break-word' CSS rule + truncate(msg, :length => 300).scan(/.{1,5}/).join("​").html_safe + end end end diff --git a/spec/controllers/errs_controller_spec.rb b/spec/controllers/errs_controller_spec.rb index 2ebc793..46fec57 100644 --- a/spec/controllers/errs_controller_spec.rb +++ b/spec/controllers/errs_controller_spec.rb @@ -23,7 +23,7 @@ describe ErrsController do it "should successfully list errs" do get :index response.should be_success - response.body.should match(@problem.message) + response.body.gsub("​", "").should match(@problem.message) end it "should list atom feed successfully" do -- libgit2 0.21.2