Sha256: ceaeebb272e07bdf55421032c5abdbc82dc7f6f0f00534f8367d5f2f139e853b

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'test_helper'

module Pelusa
  module Lint
    describe IndentationLevel do
      before do
        @lint = IndentationLevel.new
      end

      describe '#check' do
        describe 'when the class has one method with one or less indentation levels' do
          it 'returns a SuccessAnalysis' do
            klass = """
            class Foo
              def initialize
                if 9
                  3
                end
              end
            end""".to_ast

            analysis = @lint.check(klass)
            analysis.successful?.must_equal true
          end
        end

        describe 'when the class has one method with more than one indentation level' do
          it 'returns a FailureAnalysis' do
            klass = """
            class Foo
              def initialize
                if 9
                  unless 3
                    5
                  end
                end
              end
            end""".to_ast

            analysis = @lint.check(klass)
            analysis.failed?.must_equal true
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pelusa-0.0.2 test/pelusa/lint/indentation_level_test.rb
pelusa-0.0.1 test/pelusa/lint/indentation_level_test.rb