Sha256: 5099ec0679dda579a402b751f6096a062d21f1de9eeb01d55d7f4ed7de6bcb2c

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'
require 'vimwiki_markdown/options'
require 'vimwiki_markdown/template'
require 'vimwiki_markdown/exceptions'
require 'rspec-html-matchers'

module VimwikiMarkdown
  describe Template do
    let(:options) { Options.new }

    context "template" do

      subject { Template.new(options).to_s }
      before do
        allow(Options).to receive(:arguments).and_return(Options::DEFAULTS)
        allow(File).to receive(:open).with(options.template_filename,"r").and_return(StringIO.new(wiki_template))
      end

      it { should have_tag('title', text: 'Index') }
      it { should have_tag('h2', text: 'Index') }
    end

    context "missing pygments" do
      before do
        allow(Options).to receive(:arguments).and_return(Options::DEFAULTS)
      end

      it "should raise an invalid exception for missing pygments" do
        allow(File).to receive(:open).with(options.template_filename,"r").and_return(StringIO.new(template_missing_pygments))
        expect { Template.new(options).to_s }.to raise_exception(MissingRequiredParamError)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vimwiki_markdown-0.2.0 spec/lib/vimwiki_markdown/template_spec.rb
vimwiki_markdown-0.1.3 spec/lib/vimwiki_markdown/template_spec.rb
vimwiki_markdown-0.1.2 spec/lib/vimwiki_markdown/template_spec.rb
vimwiki_markdown-0.1.1 spec/lib/vimwiki_markdown/template_spec.rb
vimwiki_markdown-0.1.0 spec/lib/vimwiki_markdown/template_spec.rb
vimwiki_markdown-0.0.5 spec/lib/vimwiki_markdown/template_spec.rb
vimwiki_markdown-0.0.4 spec/lib/vimwiki_markdown/template_spec.rb
vimwiki_markdown-0.0.3 spec/lib/vimwiki_markdown/template_spec.rb