Sha256: 510c0d8403946d00eacb3be46d64b9b00ab051387960442d4b931705f8f0c01a

Contents?: true

Size: 1.56 KB

Versions: 99

Compression:

Stored size: 1.56 KB

Contents

require 'spec_helper'

describe Softcover::Book do
  context "#initialize" do
    context "valid book directory" do
      before(:all) { generate_book(id: 1) }
      after(:all)  { remove_book }

      describe "reading from book.yml" do
        its(:filenames) { should_not include "html/test-book.html"}

        its(:filenames) { should include "html/chapter-1_fragment.html"}
        its(:filenames) { should_not include "html/chapter-1.html"}
        its(:filenames) { should include "html/#{subject.slug}.html"}

        its(:filenames) { should include "config/marketing.yml"}
        its(:filenames) { should include "html/stylesheets/custom.css"}

        its(:slug) { should eq "book" }
        its(:url) { should match /\/books\/(.*?)\/redirect/ }

        it "sets chapter attributes" do
          expect(subject.chapter_attributes.first[:menu_heading]).
            to match /Frontmatter/
        end

        it "has rendered latex in menu_heading" do
          expect(subject.chapter_attributes.last[:menu_heading]).
            to match /<em>/
        end
      end

      describe "reading from marketing.yml" do
        its(:prices) { should_not be_empty }
        its(:faq) { should_not be_empty }
        its(:testimonials) { should_not be_empty }
        its(:marketing_content) { should be_empty }
      end

      describe "custom math" do
        let(:math) do
          "\"softcover\": \"\\\\texttt{softcover}\"" +
            ",\n\"unitvec\": [\"{\\\\hat #1}\", 1]"
        end

        its(:custom_math) do
          should eq math
        end
      end
    end
  end
end

Version data entries

99 entries across 99 versions & 1 rubygems

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