On 8/19/07, Edward Ocampo-Gooding <[EMAIL PROTECTED]> wrote: > David Chelimsky wrote: > > On 8/19/07, Edward Ocampo-Gooding <[EMAIL PROTECTED]> 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 > >
Is there a reason it needs to be more complicated than this? class Foo end Foo.is_a?(Class) => true Foo.new.is_a?(Class) => false _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users