[rspec-users] describing a mock_model as being an instance

Edward Ocampo-Gooding edward.og at gmail.com
Sun Aug 19 21:22:58 EDT 2007


David Chelimsky wrote:
> On 8/19/07, Edward Ocampo-Gooding <edward.og at gmail.com> wrote:
>> Is there a built-in way of describing a mock_model as being an instance, beyond
>> stubbing the eval("Object.methods - Object.new.methods") methods to throw
>> NoMethodErrors?
> 
> Huh? Can you give an example of what you are trying to achieve?

I'm writing a method that involves deciding if an object is a class or an 
instance of a class. Right now I'm creating a mock_model and setting up an 
expectation on respond_to? :new but I've got a feeling that this isn't the way 
to go.

The current mock_model returns an object that looks more like a class based on 
the methods it has (I should actually go look now and check if it's got the 
typical instantiated Object methods too...), and I'm wondering if there's a 
clean way of creating a mock_model instance that has typical instantiated Object 
methods and no Object class methods.

Edward



More information about the rspec-users mailing list