Sha256: f3e0a9329cafed7e26d63e6261071ff3d4ff822552b7557c60ae8a5dbae07abf

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

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

module Playgroundbook
  describe ChapterManifestLinter do
    include FakeFS::SpecHelpers
    let(:chapter_manifest_linter) { ChapterManifestLinter.new(page_linter) }
    let(:page_linter) { double(PageLinter) }
    let(:page_directory_name) { "test.playgroundpage" }

    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

2 entries across 2 versions & 1 rubygems

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