Sha256: d39240defcb4eaf7d35c391414280d875e5549115d255830eb84315d5623cc0a

Contents?: true

Size: 1.9 KB

Versions: 2

Compression:

Stored size: 1.9 KB

Contents

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

module Playgroundbook
  describe CutscenePageManifestLinter do
    include FakeFS::SpecHelpers
    let(:cutscene_page_manifest_linter) { CutscenePageManifestLinter.new }

    it "given a valid manifest does not fail" do
      FakeFS do
        cutscene_reference = "RealFile.html"
        plist = {
          "Name" => "Test Page",
          "CutsceneReference" => cutscene_reference
        }.to_plist
        File.open("Manifest.plist", "w") { |f| f.write(plist) }
        File.open(cutscene_reference, "w")

        expect { cutscene_page_manifest_linter.lint }.not_to raise_error
      end
    end

    context "given a cutscene path" do
      it "fails if the key doesn't exist" do
        FakeFS do
          cutscene_reference = "FakeFile.html"
          plist = {
            "Name" => "Test Page"
          }.to_plist
          File.open("Manifest.plist", "w") { |f| f.write(plist) }

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

      it "fails if that file doesn't exist" do
        FakeFS do
          cutscene_reference = "FakeFile.html"
          plist = {
            "Name" => "Test Page",
            "CutsceneReference" => cutscene_reference
          }.to_plist
          File.open("Manifest.plist", "w") { |f| f.write(plist) }

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

      it "fails with a non-HTML file" do
        FakeFS do
          cutscene_reference = "RealFile.xml"
          plist = {
            "Name" => "Test Page",
            "CutsceneReference" => cutscene_reference
          }.to_plist
          File.open("Manifest.plist", "w") { |f| f.write(plist) }
          File.open(cutscene_reference, "w")

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

Version data entries

2 entries across 2 versions & 1 rubygems

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