Sha256: 42ca456b42bb1cc436f11e2d998fd3042d08a1e1974963208bc1b31d10e95228

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe LintTrap::Linter::JSONLint do
  let(:container){LintTrap::Container::Docker.new('lintci/spin_cycle:latest', fixture_path)}
  let(:options){{}}
  subject(:linter){described_class.new}

  describe '#lint' do
    context 'when linting a bad file' do
      let(:file){fixture_path('bad.json')}

      it 'generates lint' do
        expect{|b| linter.lint([file], container, options, &b)}.to yield_successive_args(
          {
            file: file,
            line: '2',
            column: '2',
            length: nil,
            rule: nil,
            severity: 'error',
            message: 'Json strings must use double quotes'
          }, {
            file: file,
            line: '3',
            column: '2',
            length: nil,
            rule: nil,
            severity: 'error',
            message: 'Keys must be double quoted in Json. Did you mean "not"?'
          }, {
            file: file,
            line: '3',
            column: '7',
            length: nil,
            rule: nil,
            severity: 'error',
            message: 'Invalid Json number'
          }
        )
      end
    end

    context 'when linting a good file' do
      let(:file){fixture_path('good.json')}

      it 'generates no lint' do
        expect{|b| linter.lint([file], container, options, &b)}.to_not yield_control
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lint_trap-0.0.11 spec/integration/jsonlint_spec.rb
lint_trap-0.0.10 spec/integration/jsonlint_spec.rb
lint_trap-0.0.9 spec/integration/jsonlint_spec.rb
lint_trap-0.0.8 spec/integration/jsonlint_spec.rb
lint_trap-0.0.7 spec/integration/jsonlint_spec.rb