Sha256: 43b014df9fbba1530775243f56929961a25a5ae1b23127ac60b8e262cc7e22a7

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

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

module PlaygroundBookLint
  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

1 entries across 1 versions & 1 rubygems

Version Path
playground-book-lint-0.0.1 spec/playground_book_lint/root_manifest_linter_spec.rb