Sha256: 9ef6bf075de0c2d39ecf546a826d2529a5e6883067d1836361b79f537927232d

Contents?: true

Size: 922 Bytes

Versions: 15

Compression:

Stored size: 922 Bytes

Contents

require 'test_helper'
require_relative '../lib/sandi_meter/warning_scanner'

describe SandiMeter::WarningScanner do
  let(:scanner) { SandiMeter::WarningScanner.new }

  describe 'scanning class with indentation warnings' do
    let(:test_class) { read_test_file(1) }

    before do
      scanner.scan(test_class)
    end

    it 'finds indentation warnings for method' do
      scanner.indentation_warnings['def'].should eq([[3, 4]])
    end

    it 'finds indentation warnings for class' do
      scanner.indentation_warnings['class'].should eq([[2, 5]])
    end

    it 'finds indentation warnings for module' do
      scanner.indentation_warnings['module'].should eq([[1, 6]])
    end
  end

  describe 'scanning class with syntax error' do
    let(:test_class) { read_test_file(2) }

    it 'raise syntax error' do
      expect {
        scanner.scan(test_class)
      }.to raise_error(SyntaxError)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sandi_meter-1.1.8 spec/warning_scanner_spec.rb
sandi_meter-1.1.7 spec/warning_scanner_spec.rb
sandi_meter-1.1.6 spec/warning_scanner_spec.rb
sandi_meter-1.1.5 spec/warning_scanner_spec.rb
sandi_meter-1.0.5 spec/warning_scanner_spec.rb
sandi_meter-1.0.4 spec/warning_scanner_spec.rb
sandi_meter-1.0.3 spec/warning_scanner_spec.rb
sandi_meter-1.0.2 spec/warning_scanner_spec.rb
sandi_meter-1.0.1 spec/warning_scanner_spec.rb
sandi_meter-1.0.0 spec/warning_scanner_spec.rb
sandi_meter-0.0.6 spec/warning_scanner_spec.rb
sandi_meter-0.0.5 spec/warning_scanner_spec.rb
sandi_meter-0.0.4 spec/warning_scanner_spec.rb
sandi_meter-0.0.3 spec/warning_scanner_spec.rb
sandi_meter-0.0.2 spec/warning_scanner_spec.rb