Sha256: b8d4afaaa70227b2ab4b77e21de672a6bc5d4da4db98996ad4ee7ecf640637e7

Contents?: true

Size: 976 Bytes

Versions: 2

Compression:

Stored size: 976 Bytes

Contents

require 'test_helper'

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

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

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

        describe 'when the class contains a long identifier' do
          it 'returns a FailureAnalysis' do
            klass = """
            class Foo
              def initialize
                it_is_long_identifier = nil
              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.2.3 test/pelusa/lint/long_identifiers_test.rb
pelusa-0.2.2 test/pelusa/lint/long_identifiers_test.rb