Sha256: 973f41473293b96f4a21243ec269aaa91aac78d12df0b7cd9a858230bc2c8a65

Contents?: true

Size: 929 Bytes

Versions: 5

Compression:

Stored size: 929 Bytes

Contents

covers 'facets/kernel/writers'

test_case Kernel do

  method :writers do

    test do
      c = Class.new do
        attr_accessor :a
        def b=(b); @b=b; end
      end
      o = c.new
      w = o.writers

      w.assert.include?(:a=)
      w.assert.include?(:b=)
    end

    test do
      c = Class.new do
        attr_accessor :a
        def b=(b); @b=b; end
        private
        def q=(q); @q=q; end
      end
      o = c.new
      w = o.writers(:access=>:private)

      w.refute.include?(:a=)
      w.refute.include?(:b=)
      w.assert.include?(:q=)
    end

    test do
      c = Class.new do
        attr_accessor :a
        def b=(b); @b=b; end
        private
        def q=(q); @q=q; end
      end
      o = c.new
      w = o.writers(:access=>:all)

      w.assert.include?(:a=)
      w.assert.include?(:b=)
      w.assert.include?(:q=)
    end

    # TODO: Need to test more options for writers.

  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 test/core/kernel/test_writers.rb
facets-3.1.0 test/core/kernel/test_writers.rb
facets-3.0.0 test/core/kernel/test_writers.rb
facets-2.9.3 test/core/kernel/test_writers.rb
facets-2.9.2 test/core/kernel/test_writers.rb