Sha256: a17ddd04cadd43068b96febe3f3a198c35b07c1bd665b71c7a8823494f54bd03

Contents?: true

Size: 1017 Bytes

Versions: 8

Compression:

Stored size: 1017 Bytes

Contents

require 'test_helper'

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

      describe '#check' do
        describe 'when the class does not use getters, setters or properties' do
          it 'returns a SuccessAnalysis' do
            klass = """
            class Foo
              def initialize
                @name = 'john'
              end

              def name
                @name
              end
            end""".to_ast

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

        describe 'when the class uses getters, setters or properties' do
          it 'returns a FailureAnalysis' do
            klass = """
            class Foo
              attr_accessor :name
              attr_reader :foo
            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/properties_test.rb
pelusa-0.2.2 test/pelusa/lint/properties_test.rb
pelusa-0.2.1 test/pelusa/lint/properties_test.rb
pelusa-0.2.0 test/pelusa/lint/properties_test.rb
pelusa-0.1.1 test/pelusa/lint/properties_test.rb
pelusa-0.1.0 test/pelusa/lint/properties_test.rb
pelusa-0.0.2 test/pelusa/lint/properties_test.rb
pelusa-0.0.1 test/pelusa/lint/properties_test.rb