Sha256: 9632ca928b5666d4a5c28d151c6a92f43bb35f1d9229c0c8be3935a224cb57eb

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

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

module PlaygroundBookLint
  describe ChapterManifestLinter do
    include FakeFS::SpecHelpers
    let(:chapter_manifest_linter) { ChapterManifestLinter.new(page_linter) }
    let(:page_linter) { double(PageLinter) }
    let!(:page_directory_name) { 'test_page_directory_name' }

    it 'fails if no Pages defined in Manifest' do
      FakeFS do
        plist = {'Name' => 'Test'}.to_plist
        File.open('Manifest.plist', 'w') { |f| f.write(plist) }

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

    it 'fails if Pages dir specified in Manifest does not exist' do
      FakeFS do
        plist = {'Name' => 'Test', 'Pages' => [page_directory_name]}.to_plist
        File.open('Manifest.plist', 'w') { |f| f.write(plist) }
        Dir.mkdir('Pages')

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

    it 'calls through to page linter' do
      FakeFS do
        expect(page_linter).to receive(:lint)
        plist = {'Name' => 'Test', 'Pages' => [page_directory_name]}.to_plist
        File.open('Manifest.plist', 'w') { |f| f.write(plist) }
        FileUtils.mkdir_p("Pages/#{page_directory_name}")

        expect{ chapter_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/chapter_manifest_linter_spec.rb