Sha256: 1c217c7497730e7d783546c1499ac92d374fbc5a039eca132705e73598a3464c

Contents?: true

Size: 1009 Bytes

Versions: 8

Compression:

Stored size: 1009 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 = """
            class Foo
              def initialize
                @foo = 1
                @bar = 2
              end
            end""".to_ast

            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 = """
            class Foo
              def initialize
                @foo = 1
                @bar = 2
                @baz = 3
              end
            end""".to_ast

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pelusa-0.2.3 test/pelusa/lint/instance_variables_test.rb
pelusa-0.2.2 test/pelusa/lint/instance_variables_test.rb
pelusa-0.2.1 test/pelusa/lint/instance_variables_test.rb
pelusa-0.2.0 test/pelusa/lint/instance_variables_test.rb
pelusa-0.1.1 test/pelusa/lint/instance_variables_test.rb
pelusa-0.1.0 test/pelusa/lint/instance_variables_test.rb
pelusa-0.0.2 test/pelusa/lint/instance_variables_test.rb
pelusa-0.0.1 test/pelusa/lint/instance_variables_test.rb