Sha256: 92a41f87b35096733c429dc8cd9f8e53d4e14598861218946a749b94ab2c96a4

Contents?: true

Size: 1019 Bytes

Versions: 7

Compression:

Stored size: 1019 Bytes

Contents

require 'test_helper'

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

      describe '#check' do
        describe 'when the class is not a collection wrapper with more instance variables' do
          it 'returns a SuccessAnalysis' do
            klass = """
            class Foo
              def initialize
                @things = []
              end
            end""".to_ast

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

        describe 'when the class mixes collection ivars with others' do
          it 'returns a FailureAnalysis' do
            klass = """
            class Foo
              def initialize
                @things = []
                @foo = 'bar'
              end
            end""".to_ast

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

Version data entries

7 entries across 7 versions & 1 rubygems

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