I need to work with fixtures and MiniTest on a Rails project and I have
some questions on best practices with using fixtures. Please bear with
me :)

- Should I restrict fixtures attributes only to those required in my
current tests? Say, if I have no tests involving the user's role I
simply don't mention the role association in the fixtures. Model
scaffolds generally add all attributes to the fixtures...

- A friend of mine told me he wants to dump anonymized portion of a
production database to fixtures... What's your take on this?

- What's your opinion on having fixtures' names representing their use
cases rather than being very generic?

# test/fixtures/users.yml
owner_on_junior_account_with_posts_limit:
  role: owner
  account_type: junior
  posts_limit: 1000

VS

user35:
  role: role1
  account_type: account4
  posts_limit: 1000

- Is it worth to be trying to reuse fixtures as much as possible? My
considerations here are development cost and test suite performance.

- Is it worth mocking/stubbing existing fixtures (e.g. use Mocha's
:any_instance) to get to a specific edge case, or it's cleaner to just
create a new fixture set.

Finally, I'd love to find an open source project that uses fixtures and
learn best practices from there.

Any feedback is very much appreciated. Thank you guys!

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/bc8ae36b4a596c20eb641995088c981e%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to