Sha256: d656b4cceb76d653db2f840e3777daa49d438dc237de8bb6ff0dfa7574978949

Contents?: true

Size: 1.51 KB

Versions: 100

Compression:

Stored size: 1.51 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

100 entries across 100 versions & 1 rubygems

Version Path
softcover-1.10.5 spec/mathjax_spec.rb
softcover-1.10.4 spec/mathjax_spec.rb
softcover-1.10.3 spec/mathjax_spec.rb
softcover-1.10.2 spec/mathjax_spec.rb
softcover-1.10.1 spec/mathjax_spec.rb
softcover-1.10.0 spec/mathjax_spec.rb
softcover-1.9.1 spec/mathjax_spec.rb
softcover-1.9.0 spec/mathjax_spec.rb
softcover-1.8.3 spec/mathjax_spec.rb
softcover-1.8.2 spec/mathjax_spec.rb
softcover-1.8.1 spec/mathjax_spec.rb
softcover-1.8.0 spec/mathjax_spec.rb
softcover-1.7.5 spec/mathjax_spec.rb
softcover-1.7.4 spec/mathjax_spec.rb
softcover-1.7.3 spec/mathjax_spec.rb
softcover-1.7.2 spec/mathjax_spec.rb
softcover-1.7.1 spec/mathjax_spec.rb
softcover-1.7.0 spec/mathjax_spec.rb
softcover-1.6.5 spec/mathjax_spec.rb
softcover-1.6.4 spec/mathjax_spec.rb