Sha256: 05d168f44eaf6548ddf1faf9ad5467eb3f3deb871212c23af30df037697a45ec

Contents?: true

Size: 1.6 KB

Versions: 4

Compression:

Stored size: 1.6 KB

Contents

require 'test_helper'
require 'pathname'

module KafoModuleLint
  describe 'kafo-module-lint' do
    let(:manifest_file) { ManifestFileFactory.build(manifest).path }
    let(:args) { manifest_file }
    let(:captured) do
      ret = capture_subprocess_io { system("bundle exec bin/kafo-module-lint #{args}") }
      [$?, *ret]
    end
    let(:exit_code) { captured[0] }
    let(:stdout) { captured[1] }
    let(:stderr) { captured[2] }

    describe "manifest with no params" do
      let(:manifest) { ManifestFactory.build({}) }
      specify { exit_code.success?.must_equal true }
      specify { stdout.must_equal '' }
      specify { stderr.must_equal '' }
    end

    describe "manifest with built-in params" do
      let(:manifest) { ManifestFactory.build({'a' => 'String', 'b' => 'Optional[Array[Integer[0]]]'}) }
      specify { exit_code.success?.must_equal true }
      specify { stdout.must_equal '' }
      specify { stderr.must_equal '' }
    end

    describe "manifest with unknown param" do
      let(:manifest) { ManifestFactory.build({'a' => 'String', 'b' => 'Unknown[String]'}) }
      let(:error) { "#{manifest_file} parameter b: unknown data type Unknown" }
      specify { exit_code.success?.must_equal false }
      specify { stdout.must_equal (error + $/) }
      specify { stderr.must_equal '' }
    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 { exit_code.success?.must_equal true }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kafo_module_lint-1.3.0 test/kafo_module_lint/binary_test.rb
kafo_module_lint-1.1.0 test/kafo_module_lint/binary_test.rb
kafo_module_lint-1.0.3 test/kafo_module_lint/binary_test.rb
kafo_module_lint-1.0.2 test/kafo_module_lint/binary_test.rb