has207/flexmock — pull request #69 by brycecovert (2012-03-16 18:17:41+00:00)
Title: Attributes + Properties

Hi,

I've added the ability to do attributes and properties in flexmock. This should resolve one of the outstanding issues.

With properties, it'll allow you to do the standard stuff (.once, .and_return, .should_raise, etc.). I did some defensive stuff to warn people when they mock a method and a property with the same name, and also some errors when you try to use with_args() on a property.

I also added some functionality for attributes. This won't allow you to track them, or verify them, but it lets you easily set up mocked classes and modules in flexmock, which won't allow you to add properties because you can't modify builtins.

This'll allow us to do this:
flexmock(module).should_receive("method").and_return("something")
flexmock(module).should_have_attribute(SOME_CONST, "value")

The tests all work (and there are some more). I'd be happy to fix any problems you find in the code. Please let me know if you have any questions.

Bryce