Sha256: 8125bf7b8254ab2ac5e68810a670e3c8ea0060713a811ea93a1f712adf640f22

Contents?: true

Size: 882 Bytes

Versions: 3

Compression:

Stored size: 882 Bytes

Contents

require 'spec_helper'

RSpec.describe GeoCombine::Formatting do
  let(:dirty) { "<p>paragraph</p> \n on a new line" }
  subject { Object.new.extend(GeoCombine::Formatting) }
  describe '#sanitize' do
    it 'sanitizes a fragment' do
      expect(subject.sanitize(dirty)).to_not match('<p>')
    end
  end
  describe '#remove_lines' do
    it 'removes new lines' do
      expect(subject.remove_lines(dirty)).to_not match(/\n/)
    end
  end
  describe '#sanitize_and_remove_lines' do
    it 'returns a corrected string' do
      expect(subject.sanitize_and_remove_lines(dirty)).to_not match('<p>')
      expect(subject.sanitize_and_remove_lines(dirty)).to_not match(/\n/)
    end
  end
  describe '#sluggify' do
    let(:preslug) { 'HARVARD...Co_0l' }
    it 'handles multiple . and _ and uppercase' do
      expect(subject.sluggify(preslug)).to eq 'harvard-co-0l'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
geo_combine-0.5.1 spec/lib/geo_combine/formatting_spec.rb
geo_combine-0.5.0 spec/lib/geo_combine/formatting_spec.rb
geo_combine-0.4.0 spec/lib/geo_combine/formatting_spec.rb