aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2015-05-15 23:27:41 -0400
committerGeorge Claghorn <george.claghorn@gmail.com>2015-05-27 21:48:58 -0400
commit908cfef6e2f2c888e02b89fc74888786efda2a45 (patch)
tree9674dec4166259eb74133c8a845bf04862db3050 /activerecord/test/fixtures
parent27fdf4591d06d11728649714bdaf0a006908861b (diff)
downloadrails-908cfef6e2f2c888e02b89fc74888786efda2a45.tar.gz
rails-908cfef6e2f2c888e02b89fc74888786efda2a45.tar.bz2
rails-908cfef6e2f2c888e02b89fc74888786efda2a45.zip
Resolve enums in test fixtures
Currently, values for columns backing Active Record enums must be specified as integers in test fixtures: awdr: title: "Agile Web Development with Rails" status: 2 rfr: title: "Ruby for Rails" status: <%= Book.statuses[:proposed] %> This is potentially confusing, since enum values are typically specified as symbols or strings in application code. To resolve the confusion, this change permits the use of symbols or strings to specify enum values: awdr: status: :published It is compatible with fixtures that specify enum values as integers.
Diffstat (limited to 'activerecord/test/fixtures')
-rw-r--r--activerecord/test/fixtures/books.yml11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/fixtures/books.yml b/activerecord/test/fixtures/books.yml
index abe56752c6..380dd3dfca 100644
--- a/activerecord/test/fixtures/books.yml
+++ b/activerecord/test/fixtures/books.yml
@@ -3,9 +3,20 @@ awdr:
id: 1
name: "Agile Web Development with Rails"
format: "paperback"
+ status: :published
+ read_status: :read
rfr:
author_id: 1
id: 2
name: "Ruby for Rails"
format: "ebook"
+ status: "proposed"
+ read_status: "reading"
+
+ddd:
+ author_id: 1
+ id: 3
+ name: "Domain-Driven Design"
+ format: "hardcover"
+ status: 2