Sha256: e0a65196696bcc97be1176e7f5141c6cf7674c5deca314727d0f0f538aaec83a

Contents?: true

Size: 990 Bytes

Versions: 1

Compression:

Stored size: 990 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 = Pelusa.to_ast """
            class Foo
              def initialize
                not_long_identifier = nil
              end
            end"""

            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 = Pelusa.to_ast """
            class Foo
              def initialize
                it_is_long_identifier = nil
              end
            end"""

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pelusa-0.2.4 test/pelusa/lint/long_identifiers_test.rb