2015-04-26 12:48:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe EventsHelper do
|
2016-11-03 12:29:30 +05:30
|
|
|
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
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
it 'handles nil values' do
|
|
|
|
expect(helper.event_commit_title(nil)).to eq('')
|
|
|
|
end
|
2018-03-27 19:54:05 +05:30
|
|
|
|
|
|
|
it 'does not escape HTML entities' do
|
|
|
|
expect(helper.event_commit_title("foo & bar")).to eq("foo & bar")
|
|
|
|
end
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|