At the Forge - Fixtures and Factories
Fixtures have been a part of Rails testing practices since the beginning, and they still can be quite useful. But, if you're finding yourself frustrated by YAML files, or if you want to experiment with something that offers more flexibility and features, you might well want to try looking into factories. This month, I looked at two different libraries for creating Rails factories, both of which are in popular use and might be a good fit for your project.
The home page for Ruby on Rails is www.rubyonrails.com. Information about testing, including the use of fixtures, is in one of the excellent, community-written Rails guides at guides.rubyonrails.org/testing.html.
If you are interested in learning more about factories, a good starting point (as is often the case) is the Railscast site, with weekly screencasts by Ryan Bates. The Railscast that talks about fixtures is at railscasts.com/episodes/158-factories-not-fixtures.
Reuven M. Lerner, a longtime Web/database developer and consultant, is a PhD candidate in learning sciences at Northwestern University, studying on-line learning communities. He recently returned (with his wife and three children) to their home in Modi'in, Israel, after four years in the Chicago area.
- Readers' Choice Awards--Nominate Your Apps & Gadgets Now!
- diff -u: What's New in Kernel Development
- Memory Ordering in Modern Microprocessors, Part I
- Source Code Scanners for Better Code
- Security Hardening with Ansible
- Tech Tip: Really Simple HTTP Server with Python
- [<Megashare>] Watch Mrs Brown's Boys Movie Online Full Movie HD 2014
- Non-Linux FOSS: AutoHotkey
- RSS Feeds