Sha256: c02afb1a6e697235b8b9b0d07bfa528d46cece5b5d09e2d49a7044b887696869

Contents?: true

Size: 1.5 KB

Versions: 73

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

describe Softcover::Mathjax do

  subject(:mathjax) { Softcover::Mathjax }

  let(:custom_sty) do
%(\\newcommand{\\foo}{\\ensuremath{x}}
\\newcommand{\\bar}[1]{\\textbf{#1}}
% \\newcommand{\\baz}{quux}
)
  end
  let(:baz) { 'quux' }

  shared_examples "config" do

    it "should include the default macros" do
      expect(config).to include polytex
      expect(config).to include polytexnic
    end

    context "with a custom.sty" do

      before { Softcover.stub(:custom_styles).and_return(custom_sty) }

      it "should include the custom macros" do
        expect(config).to include foo
        expect(config).to include bar
      end

      it "should not include a commented-out macro" do
        expect(config).not_to include baz
      end
    end
  end

  context '#config' do

    let(:polytex)    { 'PolyTeX:    "Poly{\\\\TeX}"' }
    let(:polytexnic) { 'PolyTeXnic: "Poly{\\\\TeX}nic"' }
    let(:foo)        { 'foo: "{x}"' }
    let(:bar)        { 'bar: ["\\\\textbf{#1}", 1]' }
    let(:config)     { mathjax.config }

    it "should not raise an error" do
      expect { config }.not_to raise_error
    end

    it_should_behave_like "config"
  end

  context '#escaped_config' do
    let(:polytex)    { 'PolyTeX:    "Poly{\\\\\\\\TeX}"' }
    let(:polytexnic) { 'PolyTeXnic: "Poly{\\\\\\\\TeX}nic"' }
    let(:foo)        { 'foo: "{x}"' }
    let(:bar)        { 'bar: ["\\\\\\\\textbf{#1}", 1]' }
    let(:config)     { mathjax.escaped_config }

    it_should_behave_like "config"
  end
end

Version data entries

73 entries across 73 versions & 2 rubygems

Version Path
softcover-1.0.beta16 spec/mathjax_spec.rb
softcover-1.0.beta15 spec/mathjax_spec.rb
softcover-1.0.beta14 spec/mathjax_spec.rb
softcover-1.0.beta13 spec/mathjax_spec.rb
softcover-1.0.beta12 spec/mathjax_spec.rb
softcover-1.0.beta11 spec/mathjax_spec.rb
softcover-1.0.beta10 spec/mathjax_spec.rb
softcover-1.0.beta9 spec/mathjax_spec.rb
softcover-1.0.beta8 spec/mathjax_spec.rb
softcover-1.0.beta7 spec/mathjax_spec.rb
softcover-1.0.beta6 spec/mathjax_spec.rb
softcover-1.0.beta5 spec/mathjax_spec.rb
softcover-1.0.beta4 spec/mathjax_spec.rb
softcover-1.0.beta3 spec/mathjax_spec.rb
softcover-nonstop-1.0.beta2 spec/mathjax_spec.rb
softcover-1.0.beta2 spec/mathjax_spec.rb
softcover-1.0.beta1 spec/mathjax_spec.rb
softcover-0.9.23 spec/mathjax_spec.rb
softcover-0.9.22 spec/mathjax_spec.rb
softcover-0.9.21 spec/mathjax_spec.rb