diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-10-18 20:39:26 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-10-20 18:02:27 +0300 |
commit | 38e4d464fbafd02e8db688487502c1b7033b2373 (patch) | |
tree | 7d377f51251676f6533acd7aadea60a85fc8f66d /spec | |
parent | 7bd4c2d6e728ccf37e16c6283224d4537a5ba342 (diff) |
Merge branch '23311-fix-double-escaping' into 'master'
Stop event_commit_title from escaping its output
Fixes a double-escape issue (actually triple-escape!) viewing the activity feed
Closes #23311
Related to #23258 !6832
See merge request !6930
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/events_helper_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/helpers/events_helper_spec.rb b/spec/helpers/events_helper_spec.rb index 022aba0c0d0..594b40303bc 100644 --- a/spec/helpers/events_helper_spec.rb +++ b/spec/helpers/events_helper_spec.rb @@ -62,4 +62,21 @@ describe EventsHelper do expect(helper.event_note(input)).to eq(expected) end end + + describe '#event_commit_title' do + let(:message) { "foo & bar " + "A" * 70 + "\n" + "B" * 80 } + subject { helper.event_commit_title(message) } + + it "returns the first line, truncated to 70 chars" do + is_expected.to eq(message[0..66] + "...") + end + + it "is not html-safe" do + is_expected.not_to be_a(ActiveSupport::SafeBuffer) + end + + it "handles empty strings" do + expect(helper.event_commit_title("")).to eq("") + end + end end |