Class TestAutoObject
In: lib/auto_object.rb
Parent: ::Test::Unit::TestCase

Methods

Included Modules

Mocks::Assertions

Public Instance methods

[Source]

# File lib/auto_object.rb, line 62
    def setup
      @mock_object = Mocks::MethodLogger.new
      # Uncomment me to debug
      # @mock_object = VerboseObject.new(@mock_object, :no_rec => true)
      assert_nothing_raised do
        @obj = AutoObject.new(:logger => @mock_object)
      end
    end

[Source]

# File lib/auto_object.rb, line 75
    def test_auto_object?
      assert(! 4.auto_object?)
      assert(@obj.auto_object?)
    end

[Source]

# File lib/auto_object.rb, line 85
    def test_inspect
      assert_nothing_raised { @res = @obj.foo.bar(42).baz{}.qux * 42 - 5 }
      assert_equal '#<AutoObject: ((new.foo.bar(42).baz { ... }.qux * 42) - 5)>',
                   @res.inspect
    end

[Source]

# File lib/auto_object.rb, line 71
    def test_simple
      assert_nothing_raised { @obj.foo.bar(42).baz{}.qux * 42 - 5 }
    end

[Source]

# File lib/auto_object.rb, line 91
    def test_to_s
      assert_nothing_raised { @res = @obj.foo.bar(42).baz{}.qux * 42 - 5 }
      assert_equal '((AutoObject.new.foo.bar(42).baz { ... }.qux * 42) - 5)',
                   @res.to_s
    end

[Source]

# File lib/auto_object.rb, line 80
    def test_verbose
      assert_nothing_raised { @obj.foo.bar(42).baz{}.qux * 42 - 5 }
      assert_mock [:foo], [:bar, 42], [:baz], [:qux], [:*, 42], [:-, 5]
    end

[Validate]