Sha256: 71564557260bb11d1c54758033a4d2dc92985596fea432af5be719b928a99ae1

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require File.expand_path("../../spec_helper", __FILE__)

module Playgroundbook
  describe RootManifestLinter do
    include FakeFS::SpecHelpers
    let(:root_manifest_linter) { RootManifestLinter.new(chapter_linter) }
    let(:chapter_linter) { double(ChapterLinter) }

    it "fails if Chapters directory does not exist" do
      expect { root_manifest_linter.lint }.to raise_error(SystemExit)
    end

    it "fails if manfiest does not include Chapters" do
      FakeFS do
        Dir.mkdir("Chapters")
        plist = { "Name" => "Test" }.to_plist
        File.open("Manifest.plist", "w") { |f| f.write(plist) }

        expect { root_manifest_linter.lint }.to raise_error(SystemExit)
      end
    end

    it "calls through to lint each chapter" do
      FakeFS do
        plist = { "Chapters" => ["test_chapter_name"], "Name" => "Test" }.to_plist
        File.open("Manifest.plist", "w") { |f| f.write(plist) }
        Dir.mkdir("Chapters")

        expect(chapter_linter).to receive(:lint).with("test_chapter_name")

        expect { root_manifest_linter.lint }.to_not raise_error
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
playgroundbook-0.6.0 spec/linter/root_manifest_linter_spec.rb
playgroundbook-0.4.0 spec/linter/root_manifest_linter_spec.rb