Sha256: 4c11d0998077185ab88212c6f249f0803594251f72f0823baf33118bd06b33e7

Contents?: true

Size: 852 Bytes

Versions: 2

Compression:

Stored size: 852 Bytes

Contents

# -*- coding: utf-8 -*-
require File.expand_path('../../../../spec_helper', __FILE__)
require 'wikilink/converter/sites/wikipedia'

describe Wikilink::Converter::Sites::Wikipedia do
  subject { converter.method(:run) }

  context 'en current site' do
    let(:wikipedia) { Wikilink::Converter::Sites::Wikipedia }
    let(:converter) {
      Wikilink::Converter.new { |on| on.current_site(wikipedia) }
    }
    it { should convert('[[Ruby]]').to('<a href="/wiki/Ruby">Ruby</a>')}
  end

  context 'zh external site' do
    let(:wikipedia) { Wikilink::Converter::Sites::Wikipedia }
    let(:converter) {
      Wikilink::Converter.new(lang: 'zh') do |on|
        on.site('wiki', wikipedia)
      end
    }
    it { should convert('[[wiki:红宝石]]').to('<a class="external" href="http://zh.wikipedia.org/wiki/红宝石">wiki:红宝石</a>')}
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wikilink-converter-0.2.1 spec/wikilink/converter/sites/wikipedia_spec.rb
wikilink-converter-0.1.0 spec/wikilink/converter/sites/wikipedia_spec.rb