Sha256: e6d1c0eb4437eb69c3c309d9984032e0d7d20fd2b8b54757b448dbbe4c2212bd
Contents?: true
Size: 1009 Bytes
Versions: 3
Compression:
Stored size: 1009 Bytes
Contents
# encoding: utf-8 require 'spec_helper' RSpec.describe Loaf::CrumbFormatter, '.format_name' do let(:formatter) { Class.new do extend Loaf::CrumbFormatter def self.truncate(name, options) name end end } it 'returns name error if breadcrumb name is nil' do expect(formatter.format_name('')).to eql('') end it "doesn't capitalize by default" do name = 'some random name' formatted = formatter.format_name(name) expect(formatted).to eql(name) end it 'capitalizes crumb name with capitalize option' do name = 'some random name' formatted = formatter.format_name(name, capitalize: true) expect(formatted).to eql('Some random name') end it 'shortens crumb to provided length' do name = 'very long name that is more that 30 characters long' allow(formatter).to receive(:truncate).with(name, length: 30). and_return(name[0..30]) expect(formatter.format_name(name, crumb_length: 30)).to eql(name[0..30]) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
loaf-0.6.0 | spec/unit/crumb_formatter_spec.rb |
loaf-0.5.0 | spec/unit/crumb_formatter_spec.rb |
loaf-0.4.0 | spec/unit/crumb_formatter_spec.rb |