Sha256: c4c57cfe9bf13ffec0d1f472dcb929a1be472f46c665e0900bc40208cd6dbed1
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
require 'test_helper' require 'kafo_module_lint/linter' require 'pathname' module KafoModuleLint describe Linter do let(:manifest_file) { ManifestFileFactory.build(manifest).path } let(:linter) { Linter.new(manifest_file) } describe "with no params" do let(:manifest) { ManifestFactory.build({}) } specify { linter.pass?.must_equal true } specify { linter.errors.must_equal [] } specify { proc { linter.puts_errors }.must_output nil } end describe "with built-in params" do let(:manifest) { ManifestFactory.build({'a' => 'String', 'b' => 'Optional[Array[Integer[0]]]'}) } specify { linter.pass?.must_equal true } specify { linter.errors.must_equal [] } specify { proc { linter.puts_errors }.must_output nil } end describe "with unknown param" do let(:manifest) { ManifestFactory.build({'a' => 'String', 'b' => 'Unknown[String]'}) } let(:error) { "#{manifest_file} parameter b: unknown data type Unknown" } specify { linter.pass?.must_equal false } specify { linter.errors.must_equal [error] } specify { proc { linter.puts_errors }.must_output (error + $/) } end describe "with relative path" do let(:manifest) { ManifestFactory.build({}) } let(:manifest_file) do Pathname.new(ManifestFileFactory.build(manifest).path).relative_path_from(Pathname.new(Dir.pwd)).to_s end specify { linter.pass?.must_equal true } end describe "with wrong argument count" do let(:manifest) { ManifestFactory.build({'a' => 'String', 'b' => 'Undef["foo"]'}) } let(:error) { /#{Regexp.escape(manifest_file)} parameter b: wrong number of arguments \(.*1.*0.*\)/ } specify { linter.pass?.must_equal false } specify { linter.errors.first.must_match error } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kafo_module_lint-1.3.0 | test/kafo_module_lint/linter_test.rb |