Sha256: 291a8e4062ab674149d6ab52c80731a479456392d835b0cb32927e960c1d9bf8

Contents?: true

Size: 1023 Bytes

Versions: 1

Compression:

Stored size: 1023 Bytes

Contents

require 'test_helper'

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

      describe '#check' do
        describe 'when the class uses less than 3 ivars' do
          it 'returns a SuccessAnalysis' do
            klass = Pelusa.to_ast """
            class Foo
              def initialize
                @foo = 1
                @bar = 2
              end
            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
              def initialize
                @foo = 1
                @bar = 2
                @baz = 3
              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/instance_variables_test.rb