Plugins - fixture_references

StarAdd to favorites

fixture_references

fixture_references adds support for referencing external fixtures (by name) from within a fixture definition.

Resources

Announcement

Wiki

API

Development

Source

Description

When writing many complex fixtures for testing within your applications or plugins, it can become cumbersome to keep track of which fixtures reference which other fixtures and going back and forther between files to track ids. This plugin takes the route offered by unit tests by allowing you to reference those fixtures by name rathern than by id.

Usage

See the PluginAWeek::FixtureReferences API for usage information.

Example

employees.yml:

  <% id = 0 %>
  bob:
    id: <%= id += 1 %>
    name: Bob

  joe:
    id: <%= id += 1 %>
    name: Joe

departments.yml:

  <%
  fixtures :employees
  id = 0
  %>

  packaging:
    id: <%= id += 1 %>
    name: Packaging
    manager_id: <%= employees(:bob) %>

Testing

Before you can run any tests, the following gems must be installed:

Dependencies

This plugin does not depend on the presence of any other plugin.

Aaron Pfeifer, Neil Abraham

http://wiki.pluginaweek.org/Fixture_references

http://svn.pluginaweek.org/trunk/plugins/active_record/migrations/fixture_references

Rails' (MIT)

  • Currently 4.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Testing

Tags

Comments

Add a comment

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?