Sha256: 8813fa3a3ef4d8cb7dc362bf5778365d2b7f4468398eafab470d7d8482ebc0d2

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

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

module Playgroundbook
  describe Linter do
    let(:linter) { Linter.new(test_playground_book, contents_linter) }
    let(:contents_linter) { double(ContentsLinter) }

    it "initializes correctly" do
      expect(linter.playground_file_name) == test_playground_book
    end

    it "exits on lint failure" do
      allow(linter).to receive(:contents_dir_exists?)
        .and_return(false)

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

    it "fails when file does not exist" do
      allow(linter).to receive(:contents_dir_exists?)
        .and_return(false)
      allow(linter).to receive(:fail_lint)
        .with("No Contents directory")
        .and_raise(SystemExit)

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

    it "lints" do
      allow(linter).to receive(:contents_dir_exists?)
        .and_return(true)
      allow(contents_linter).to receive(:lint)
      expect(Dir).to receive(:chdir).with(test_playground_book)

      linter.lint
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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