Commit 6be154d521d7dd7cd94edb86e9bede2cecfd0d0e
1 parent
5386e433
Exists in
master
and in
1 other branch
Fix failing specs - test for blank problem.message before operating on it
Showing
2 changed files
with
5 additions
and
4 deletions
Show diff stats
app/helpers/errs_helper.rb
| ... | ... | @@ -8,9 +8,10 @@ module ErrsHelper |
| 8 | 8 | end |
| 9 | 9 | |
| 10 | 10 | def trucated_err_message(problem) |
| 11 | - msg = truncate(problem.message, :length => 300) | |
| 12 | - # Insert invisible unicode characters so that firefox can emulate 'word-wrap: break-word' CSS | |
| 13 | - msg.scan(/.{1,5}/).join("​").html_safe | |
| 11 | + unless (msg = problem.message).blank? | |
| 12 | + # Truncate & insert invisible chars so that firefox can emulate 'word-wrap: break-word' CSS rule | |
| 13 | + truncate(msg, :length => 300).scan(/.{1,5}/).join("​").html_safe | |
| 14 | + end | |
| 14 | 15 | end |
| 15 | 16 | end |
| 16 | 17 | ... | ... |
spec/controllers/errs_controller_spec.rb
| ... | ... | @@ -23,7 +23,7 @@ describe ErrsController do |
| 23 | 23 | it "should successfully list errs" do |
| 24 | 24 | get :index |
| 25 | 25 | response.should be_success |
| 26 | - response.body.should match(@problem.message) | |
| 26 | + response.body.gsub("​", "").should match(@problem.message) | |
| 27 | 27 | end |
| 28 | 28 | |
| 29 | 29 | it "should list atom feed successfully" do | ... | ... |