Basics of test fixtures
Fixtures are basically just sample data we set up to be used with our tests. They are written as individual entries in YAML files, the files being named after the model they represent. For example, since our article model is stored in a physical kb_article.rb
file, the associated fixture would be named kb_articles.yml
and could contain something similar to the following:
one: id: 1 category_id: 1 title: "Sample Article One" summary: "Summary of Sample Article One" content: "Lorem Ipsum …"
Each fixture is named (one
, in the preceding example) and is then followed by an indented list of key/value pairs. For a much more detailed dive into fixtures, I would recommend the guide at http://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures.
Note
For more information on Redmine's plugin generators, visit http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial#Creating-a-new-Plugin.
Working around a Redmine testing issue
This book is based on the Redmine...