Sha256: 7ef9db1d524432518b7ef15f1fdfaea8493d8864ce68c8ed05a4654f01002167

Contents?: true

Size: 940 Bytes

Versions: 6

Compression:

Stored size: 940 Bytes

Contents

require 'test_helper'

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

      describe '#check' do
        describe 'when the class contains no short identifiers' do
          it 'returns a SuccessAnalysis' do
            klass = """
            class Foo
              def initialize
                foo = 3
              end
            end""".to_ast

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

        describe 'when the class contains a short identifier' do
          it 'returns a FailureAnalysis' do
            klass = """
            class Foo
              def initialize
                x = 2
              end
            end""".to_ast

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pelusa-0.2.1 test/pelusa/lint/short_identifiers_test.rb
pelusa-0.2.0 test/pelusa/lint/short_identifiers_test.rb
pelusa-0.1.1 test/pelusa/lint/short_identifiers_test.rb
pelusa-0.1.0 test/pelusa/lint/short_identifiers_test.rb
pelusa-0.0.2 test/pelusa/lint/short_identifiers_test.rb
pelusa-0.0.1 test/pelusa/lint/short_identifiers_test.rb