Sha256: 492b2ecb8b418da49a7d85b645e7713bcb0880ac2cd17fcf4ba58f95d560d466
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe Caramelize::SwapWikiLinks do describe '#run' do subject(:run) { filter.run } let(:filter) { described_class.new(body) } context 'with wiki link with title' do let(:body) { '[[statistics|Driver & Team Statistics]]' } it 'swaps title and target' do expect(run).to eq '[[Driver & Team Statistics|statistics]]' end end context 'with wiki title with spaces' do let(:body) { '[[Release 1 0]]' } it 'replaces space with dashes' do expect(run).to eq '[[Release 1 0|release_1_0]]' end end context 'with wiki title with dashes' do let(:body) { '[[Release-1.0]]' } it 'removes dots' do expect(run).to eq '[[Release-1.0|release-10]]' end end context 'with wiki link with spaces and without title' do let(:body) { '[[Intra wiki link]]' } it 'simples link to hyperlink' do expect(run).to eq '[[Intra wiki link|intra_wiki_link]]' end context 'with replace in full file' do let(:body) { File.read(File.join(['spec', 'fixtures', 'markup', 'swap-links-input.textile'])) } it 'returns as expected' do output_text = File.read(File.join(['spec', 'fixtures', 'markup', 'swap-links-output.textile'])) expect(run).to eq output_text end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
caramelize-1.2.0 | spec/lib/caramelize/filters/swap_wiki_links_spec.rb |