Sha256: aeb6d12b3297e148c50e555f27dff6ade446af65188d49e44953977ca584f648

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe MisalignedUnindentationWarning do
  context 'when fixing' do
    it 'is a line-based warning' do
      MisalignedUnindentationWarning.new('(stdin)', 'hello', 80).should be_a(LineWarning)
    end

    it 'matches nothing' do
      MisalignedUnindentationWarning.should_not warn(' a + b', 2)
    end

    it 'fixes by removing more spaces than expected' do
      MisalignedUnindentationWarning.should correct_to('   a + b', '  a + b', 2)
    end

    it 'fixes by adding a second space' do
      MisalignedUnindentationWarning.should correct_to(' a + b', '  a + b', 2)
    end

    it 'fixes by adding indentation' do
      MisalignedUnindentationWarning.should correct_to('a + b', '    a + b', 4)
    end

    it 'describes the incorrect indentation values' do
      warning = MisalignedUnindentationWarning.new('(stdin)', '   a + b', 2)
      other_warning = MisalignedUnindentationWarning.new('(stdin)', ' a + b', 2)
      warning_3 = MisalignedUnindentationWarning.new('(stdin)', 'a + b', 4)
      warning.desc.should =~ /Expected 2/
      warning.desc.should =~ /found 3/
      other_warning.desc.should =~ /Expected 2/
      other_warning.desc.should =~ /found 1/
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wool-0.5.1 spec/warning_specs/misaligned_unindentation_spec.rb