BigW Consortium Gitlab

events_helper_spec.rb 611 Bytes
Newer Older
1 2 3
require 'spec_helper'

describe EventsHelper do
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
  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
19 20 21 22

    it 'handles nil values' do
      expect(helper.event_commit_title(nil)).to eq('')
    end
23
  end
24
end