Re: [rspec-users] fixtures and associations

2008-12-18 Thread Daniel Lopes
Thanks everybody... Atenciosamente, Daniel Lopes  Area Criações Design, Websites e Sistemas Web Visite: http://www.areacriacoes.com.br/projects http://blog.areacriacoes.com.br/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 55 (31) 3077-4560 / 55 (3

Re: [rspec-users] fixtures and associations

2008-12-18 Thread Mischa Fierer
oops that last one was supposed to be http://github.com/ianwhite/pickle/tree/master similar names On Thu, Dec 18, 2008 at 8:16 AM, Mischa Fierer wrote: > > http://toolmantim.com/article/2008/10/27/fixtureless_datas_with_machinist_and_sham > > http://www.slideshare.net/toolmantim/cucumbers-pres

Re: [rspec-users] fixtures and associations

2008-12-18 Thread Daniel Lopes
So, I think the problem is my fixture became crazy with id's and not assign the right id for the right object in association when I try use Rails 2 sintax for fixtures ( omitting the ids and using the name of the fixture in the association instead of id ) ... when I change everything to fixed id in

Re: [rspec-users] fixtures and associations

2008-12-18 Thread Mischa Fierer
http://toolmantim.com/article/2008/10/27/fixtureless_datas_with_machinist_and_sham http://www.slideshare.net/toolmantim/cucumbers-presentation http://github.com/tpope/pickler/tree/master On Thu, Dec 18, 2008 at 7:24 AM, Daniel Lopes wrote: > I really don't know what's going on with those hell

Re: [rspec-users] fixtures and associations

2008-12-18 Thread Mark Wilden
On Thu, Dec 18, 2008 at 7:24 AM, Daniel Lopes wrote: > I really don't know what's going on with those hell fixtures, and start > thinking I will never find... I will try migrate all my fixtures to > factory-girl, the only problem are my six hundred examples and no time to > change all. You don't

Re: [rspec-users] fixtures and associations

2008-12-18 Thread Daniel Lopes
I really don't know what's going on with those hell fixtures, and start thinking I will never find... I will try migrate all my fixtures to factory-girl, the only problem are my six hundred examples and no time to change all. Somebody have any link about rspec + factory-girl ? or maybe link to any

Re: [rspec-users] fixtures and associations

2008-12-17 Thread Daniel Lopes
I think I was misunderstood. I am not saying to use create rather than create! ... In this case, I just use it because will help me with puts for debug my own error in spec. In this case a really don't know what is going on, if I use create! I can't store the value in a var and then try to look wha

Re: [rspec-users] fixtures and associations

2008-12-17 Thread aslak hellesoy
On Thu, Dec 18, 2008 at 2:02 AM, Daniel Lopes wrote: > I know... I just don't use create!, in this special case, because it will > be more complicate to know what field have the error . > No it won't. The error message tells you what field has the error, and if creation is unsuccessful you *need*

Re: [rspec-users] fixtures and associations

2008-12-17 Thread Daniel Lopes
I know... I just don't use create!, in this special case, because it will be more complicate to know what field have the error . I'm still scratching my head, my @tenant instance var on spec has values for user_id and owner_id and don't understand why my validates_associated :property raise an erro

Re: [rspec-users] fixtures and associations

2008-12-17 Thread aslak hellesoy
On Thu, Dec 18, 2008 at 1:38 AM, Daniel Lopes wrote: > Hello Pat, the error still the sa...@errors={"user"=>["can't be blank"]} > > But if we look on @base we have user: > @base=# ... > > > And my code is: > describe Tenant do > fixtures :properties, :users ,:owners > > def create_tenant(optio

Re: [rspec-users] fixtures and associations

2008-12-17 Thread Daniel Lopes
Hello Pat, the error still the sa...@errors={"user"=>["can't be blank"]} But if we look on @base we have user: @base=# And my code is: describe Tenant do fixtures :properties, :users ,:owners def create_tenant(options = {}) record = Tenant.create({ :property => properties(:two),

Re: [rspec-users] fixtures and associations

2008-12-17 Thread Pat Maddox
On Wed, Dec 17, 2008 at 2:13 PM, Daniel Lopes wrote: > Hello Pat, even I load all my fixtures it still not reading anything from > users.yml ... > I will look at factory_girl but before I need understand what happening. > I try this: > require File.expand_path(File.dirname(__FILE__) + '/../spec_he

Re: [rspec-users] fixtures and associations

2008-12-17 Thread Matt Wynne
On 17 Dec 2008, at 21:07, Pat Maddox wrote: I highly recommend ditching fixtures all together. You avoid funky shit like this, and you won't have coupling between tests that occurs with fixtures, and you'll be able to create more clear specs because you do all the setup in the spec itself.

Re: [rspec-users] fixtures and associations

2008-12-17 Thread Daniel Lopes
Hello Pat, even I load all my fixtures it still not reading anything from users.yml ... I will look at factory_girl but before I need understand what happening. I try this: require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Tenant do fixtures :properties, :users , :o

Re: [rspec-users] fixtures and associations

2008-12-17 Thread Pat Maddox
You are loading the users fixtures. You need to change your fixtures line to read fixtures :properties, :users (and any other models' fixtures you want to use) I highly recommend ditching fixtures all together. You avoid funky shit like this, and you won't have coupling between tests that occu

Re: [rspec-users] fixtures and associations

2008-12-17 Thread Daniel Lopes
I get cannot be null error user in active record object... like below: properties(:two).valid? return false, but I don't understand why... because my properties.yml file is like below: two: user: aaron owner: tania address: Rua de teste address_number: 250 neighborhood: Bairro ABC ...

Re: [rspec-users] fixtures and associations

2008-12-17 Thread Pat Maddox
Hi Daniel, What happens when you do properties(:two).valid? p properties(:two).errors It looks like that fixture is not valid. Pat "Daniel Lopes" writes: > Hello David, the error is only in tenant_spec ... in property_spec all my > examples passed. The error is in "@tenant.errors.should be_

Re: [rspec-users] fixtures and associations

2008-12-17 Thread Daniel Lopes
Hello David, the error is only in tenant_spec ... in property_spec all my examples passed. The error is in "@tenant.errors.should be_empty" line and the message is expected empty? to return true, got false If I use puts to print my @tenant object before the assertion I get those values: #["is not

Re: [rspec-users] fixtures and associations

2008-12-17 Thread David Chelimsky
On Wed, Dec 17, 2008 at 12:37 PM, Daniel Lopes wrote: > Hello... I want ask for a help in error that don't understand. > I have properties model and tenants model. Tenant belongs to Property and > Property has many Tenants... I try this test association but allways get > "not valid" error for asso

[rspec-users] fixtures and associations

2008-12-17 Thread Daniel Lopes
Hello... I want ask for a help in error that don't understand. I have properties model and tenants model. Tenant belongs to Property and Property has many Tenants... I try this test association but allways get "not valid" error for association. Anyone can help? I post all my classes below: My Ten