Sha256: 9fc7e04aea3a86d2b1bfb3968858cf94f2280a356c2782a68fd8a719de1d75d2
Contents?: true
Size: 1.58 KB
Versions: 9
Compression:
Stored size: 1.58 KB
Contents
require 'spec_helper' describe Bergamasco::Summarize do subject { Bergamasco::Summarize } it 'should truncate after 250 characters' do filepath = fixture_path + 'cool-dois-without-yml.md' file = IO.read(filepath) content = subject.summary(file, length: 250) expect(content.length).to eq(250) expect(content).to start_with("In 1998 Tim Berners-Lee coined") end it 'should truncate after 75 characters' do filepath = fixture_path + 'cool-dois-without-yml.md' file = IO.read(filepath) content = subject.summary(file, length: 75) expect(content.length).to eq(83) expect(content).to start_with("In 1998 Tim Berners-Lee coined") end it 'should truncate at separator' do filepath = fixture_path + 'cool-dois-without-yml.md' file = IO.read(filepath) content = subject.summary(file) expect(content).to start_with("In 1998 Tim Berners-Lee coined") expect(content).to end_with("the referenced resource.") end it 'should truncate at separator and convert to html' do filepath = fixture_path + 'cool-dois-without-yml.md' file = IO.read(filepath) html = Bergamasco::Markdown.render_html(file, skip_yaml_header: true, csl: 'spec/fixtures/apa.csl', bibliography: 'spec/fixtures/references.bib') content = subject.summary_from_html(html, skip_yaml_header: true, csl: 'spec/fixtures/apa.csl', bibliography: 'spec/fixtures/references.bib') expect(content).to start_with("In 1998 Tim Berners-Lee coined the term cool URIs (1998), that is URIs that don’t change.") expect(content).to end_with("the referenced resource.") end end
Version data entries
9 entries across 9 versions & 1 rubygems