Re: [rspec-users] Error when mocking a method in a class

2008-12-30 Thread Juanma Cervera
Josh Knowles wrote: >There are forks out on github which have specs and have > fixed the problem with validate_uniqueness_of. I have test a plugin with that fixed (from negonicrac) and it still has the same problem for me. I see that this plugin already has specs, and want to try them. But I don

Re: [rspec-users] Error when mocking a method in a class

2008-12-29 Thread Josh Knowles
On Mon, Dec 29, 2008 at 7:20 AM, David Chelimsky wrote: > I don't see any specs for the rspec-on-rails-matchers library on > github, and no activity in 9 months, so I'm guessing that it is > incomplete/no longer being maintained. > > Josh Knowles, if you're reading this, can you respond? I unfort

Re: [rspec-users] Error when mocking a method in a class

2008-12-29 Thread Juanma Cervera
David Chelimsky wrote: > I'm not really sure why this is stubbing find, or why the stub value > is true instead of a model. Actually, I don't even see how this would > specify validating uniqueness of the attribute without very specific > setup: > > first = Centro.create(:nombre => "example") > s

Re: [rspec-users] Error when mocking a method in a class

2008-12-29 Thread David Chelimsky
On Mon, Dec 29, 2008 at 5:04 AM, Juanma Cervera wrote: > I am fighting with an error using rspec-on-rails-matchers. > > I have a model called "Centro" based in this table > > create_table "centros", :force => true do |t| >t.string "nombre" >t.string "cif" >t.string "domicilio" >

Re: [rspec-users] Error when mocking a method in a class

2008-12-29 Thread Juanma Cervera
Well, it seems tha the error is indeed in the stubbing of the find method in the class of the model. def validate_uniqueness_of(attribute) return simple_matcher("model to validate the uniqueness of #{attribute}") do |model| model.class.stub!(:find).and_return(true) !model.valid? && mod

[rspec-users] Error when mocking a method in a class

2008-12-29 Thread Juanma Cervera
I am fighting with an error using rspec-on-rails-matchers. I have a model called "Centro" based in this table create_table "centros", :force => true do |t| t.string "nombre" t.string "cif" t.string "domicilio" t.string "codigo_postal" t.string "poblacion" t.str