Sha256: 1cf84d12cc450a0967c1626039d5083a46e6ed4f6fbb0d966761712dcbdf89a4

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'
require 'tailor/formatter'

describe Tailor::Formatter do
  describe '#problems_at_level' do
    let(:problems) do
      msg = 'File contains invalid Ruby; '
      msg << 'run `ruby -c [your_file.rb]` for more details.'

      {
        'some_file.rb' => [
          {
            type: 'allow_invalid_ruby',
            line: 0,
            column: 0,
            message: msg,
            level: :warn
          }
        ]
      }
    end

    context 'problems are empty' do
      it 'returns an empty Array' do
        subject.problems_at_level({}, :error).should == []
      end
    end

    context 'the level asked for exists in the problems' do
      it 'returns the problem' do
        msg = 'File contains invalid Ruby; '
        msg << 'run `ruby -c [your_file.rb]` for more details.'

        subject.problems_at_level(problems, :warn).should == [
          {
            type: 'allow_invalid_ruby',
            line: 0,
            column: 0,
            message: msg,
            level: :warn
          }
        ]
      end
    end

    context 'the level asked for does not exist in the problems' do
      it 'returns an empty Array' do
        subject.problems_at_level(problems, :error).should == []
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tailor-1.4.0 spec/unit/tailor/formatter_spec.rb