Sha256: 42309e5b0849687bed4269d77f8b8e521f9c32c6d42754ec7cf88f374bf8fa29

Contents?: true

Size: 1015 Bytes

Versions: 6

Compression:

Stored size: 1015 Bytes

Contents

require 'spec_helper'

describe SCSSLint::Reporter::FilesReporter do
  subject { described_class.new(lints, [], nil) }

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

      it 'returns nil' do
        subject.report_lints.should be_nil
      end
    end

    context 'when there are lints' do
      let(:filenames) { ['some-filename.scss', 'some-filename.scss', 'other-filename.scss'] }

      let(:lints) do
        filenames.map do |filename|
          SCSSLint::Lint.new(SCSSLint::Linter::Comment.new, filename, SCSSLint::Location.new, '')
        end
      end

      it 'prints each file on its own line' do
        subject.report_lints.count("\n").should == 2
      end

      it 'prints a trailing newline' do
        subject.report_lints[-1].should == "\n"
      end

      it 'prints the filename for each lint' do
        filenames.each do |filename|
          subject.report_lints.scan(filename).count.should == 1
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
scss_lint-0.60.0 spec/scss_lint/reporter/files_reporter_spec.rb
scss_lint-0.59.0 spec/scss_lint/reporter/files_reporter_spec.rb
scss_lint-0.58.0 spec/scss_lint/reporter/files_reporter_spec.rb
scss_lint-0.57.1 spec/scss_lint/reporter/files_reporter_spec.rb
scss_lint-0.57.0 spec/scss_lint/reporter/files_reporter_spec.rb
scss_lint-0.56.0 spec/scss_lint/reporter/files_reporter_spec.rb