Sha256: 98db5fb90650f5a5bb532d5895de9ced379814f5922c164a2a1eab8d9a79d019

Contents?: true

Size: 850 Bytes

Versions: 1

Compression:

Stored size: 850 Bytes

Contents

require 'spec_helper'
require 'tailor/rulers/spaces_after_comma_ruler'

describe Tailor::Rulers::SpacesAfterCommaRuler do
  subject { Tailor::Rulers::SpacesAfterCommaRuler.new(nil, {}) }

  describe '#comma_update' do
    it 'adds the column number to @comma_columns' do
      subject.comma_update(',', 2, 1)
      expect(subject.instance_variable_get(:@comma_columns)).to eq [1]
    end
  end

  describe '#check_spaces_after_comma' do
    context 'no event after comma' do
      let(:lexed_line) do
        l = double 'LexedLine'
        allow(l).to receive(:event_at)
        allow(l).to receive(:index)

        l
      end

      it 'does not detect any problems' do
        expect(Tailor::Problem).to_not receive(:new)
        expect { subject.check_spaces_after_comma(lexed_line, 1) }.
          to_not raise_error
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tailor-1.4.1 spec/unit/tailor/rulers/spaces_after_comma_ruler_spec.rb