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.
|Hacking a Safe with Bash||Jul 28, 2015|
|KDE Reveals Plasma Mobile||Jul 28, 2015|
|Huge Package Overhaul for Debian and Ubuntu||Jul 23, 2015|
|diff -u: What's New in Kernel Development||Jul 22, 2015|
|Shashlik - a Tasty New Android Simulator||Jul 21, 2015|
|Embed Linux in Monitoring and Control Systems||Jul 20, 2015|
- KDE Reveals Plasma Mobile
- Hacking a Safe with Bash
- Huge Package Overhaul for Debian and Ubuntu
- diff -u: What's New in Kernel Development
- Shashlik - a Tasty New Android Simulator
- Home Automation with Raspberry Pi
- The Controversy Behind Canonical's Intellectual Property Policy
- Embed Linux in Monitoring and Control Systems
- General Relativity in Python
- One Port to Rule Them All!