Sha256: 7c53454dd89b003860fcbfc691e360e9018f05e42c52d6ef633f7114a516d792

Contents?: true

Size: 1.12 KB

Versions: 21

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe SCSSLint::Reporter::ConfigReporter do
  subject { YAML.load(result) }
  let(:result) { described_class.new(lints).report_lints }

  describe '#report_lints' do
    context 'when there are no lints' do
      let(:lints) { [] }

      it 'returns nil' do
        result.should be_nil
      end
    end

    context 'when there are lints' do
      let(:linters) do
        [SCSSLint::Linter::FinalNewline, SCSSLint::Linter::BorderZero,
         SCSSLint::Linter::BorderZero, nil]
      end
      let(:lints) do
        linters.each.map do |linter|
          SCSSLint::Lint.new(linter ? linter.new : nil, '',
                             SCSSLint::Location.new, '')
        end
      end

      it 'adds one entry per linter' do
        subject['linters'].size.should eq 2
      end

      it 'sorts linters by name' do
        subject['linters'].map(&:first).should eq %w[BorderZero FinalNewline]
      end

      it 'disables all found linters' do
        subject['linters']['BorderZero']['enabled'].should eq false
        subject['linters']['FinalNewline']['enabled'].should eq false
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
scss-lint-0.26.0 spec/scss_lint/reporter/config_reporter_spec.rb