Sha256: d1c1ea371d6700b7f905cf2fff643edd7d976a2c8b3a4b6173374f8633cbf033

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents

  #  _____         _
  # |_   _|__  ___| |_
  #   | |/ _ \/ __| __|
  #   | |  __/\__ \ |
  #   |_|\___||___/\__|
  #
  # for lib/facets/kernel/withattr.rb
  #
  # Extracted Mon Sep 03 16:23:07 -0700 2007
  # w/ Test Extraction Ratchet
  #

 require 'facets/kernel/withattr.rb'



  require 'test/unit'

  class TCKernel < Test::Unit::TestCase
    # fixture for #with_reader, #with_writer and #with_accessor
    class TestWith
      def initialize
        with_reader :foo => "FOO"
        with_writer :bar => "BAR"
        with_accessor :baz => "BAZ"
      end
      def get_bar
        @bar
      end
    end

    def test_with_reader
      assert_nothing_raised { @t = TestWith.new }
      assert_equal("FOO", @t.foo)
    end

    def test_with_writer
      assert_nothing_raised { @t = TestWith.new }
      assert_equal("BAR", @t.get_bar)
      @t.bar = "BAR2"
      assert_equal("BAR2", @t.get_bar)
    end

    def test_with_accessor
      assert_nothing_raised { @t = TestWith.new }
      assert_equal("BAZ", @t.baz)
      @t.baz = "BAZ2"
      assert_equal("BAZ2", @t.baz)
    end
  end



Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.0.0 test/unit/kernel/test_withattr.rb
facets-2.0.1 test/unit/kernel/test_withattr.rb
facets-2.0.2 test/unit/kernel/test_withattr.rb
facets-2.0.5 test/unit/kernel/test_withattr.rb
facets-2.1.1 test/unit/kernel/test_withattr.rb
facets-2.1.2 test/unit/kernel/test_withattr.rb
facets-2.1.0 test/unit/kernel/test_withattr.rb
facets-2.0.3 test/unit/kernel/test_withattr.rb
facets-2.0.4 test/unit/kernel/test_withattr.rb
facets-2.1.3 test/unit/kernel/test_withattr.rb