Sha256: 40541667a54b8b02b5343a0b23e58f80dffafdc57536bafbe895c3b604573dba

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

require 'test_helper'

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

      describe '#check' do
        describe 'when the class has less than 50 lines' do
          it 'returns a SuccessAnalysis' do
            klass = Pelusa.to_ast """
            class Foo
              attr_accessor :foo
              attr_accessor :bar
            end"""

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

        describe 'when the class has more than 50 lines' do
          it 'returns a FailureAnalysis' do
            klass = Pelusa.to_ast """
            class Foo
              attr_accessor :foo
              #{"\n" * 80}
              attr_accessor :bar
            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/line_restriction_test.rb