aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures/other_books.yml
diff options
context:
space:
mode:
authorTongfei Gao <gaotongfei1995@gmail.com>2019-05-18 20:58:22 +0800
committerTongfei Gao <gaotongfei1995@gmail.com>2019-07-27 16:40:16 +0800
commitc09a4fd23d7d52552132edde7ad155f366c560b8 (patch)
tree689a66272dffccef08230af259a687ed4be960cd /activerecord/test/fixtures/other_books.yml
parentd1ffe59ab5fd6e811833c127d43b32e87b5d7131 (diff)
downloadrails-c09a4fd23d7d52552132edde7ad155f366c560b8.tar.gz
rails-c09a4fd23d7d52552132edde7ad155f366c560b8.tar.bz2
rails-c09a4fd23d7d52552132edde7ad155f366c560b8.zip
Allow specify fixtures to be ignored
Allow specifying what fixtures can be ignored by setting `ignore` in fixtures YAML file: # users.yml _fixture: ignore: - base base: &base admin: false introduction: "This is a default description" admin: <<: *base admin: true visitor: <<: *base In the above example, "base" fixture will be ignored when creating users fixture. This is helpful when you want to inherit attributes and it makes your fixtures more "DRY".
Diffstat (limited to 'activerecord/test/fixtures/other_books.yml')
-rw-r--r--activerecord/test/fixtures/other_books.yml26
1 files changed, 26 insertions, 0 deletions
diff --git a/activerecord/test/fixtures/other_books.yml b/activerecord/test/fixtures/other_books.yml
new file mode 100644
index 0000000000..62806c03d7
--- /dev/null
+++ b/activerecord/test/fixtures/other_books.yml
@@ -0,0 +1,26 @@
+_fixture:
+ model_class: Book
+ ignore:
+ - PUBLISHED
+ - PUBLISHED_PAPERBACK
+ - PUBLISHED_EBOOK
+
+PUBLISHED: &PUBLISHED
+ status: :published
+
+PUBLISHED_PAPERBACK: &PUBLISHED_PAPERBACK
+ <<: *PUBLISHED
+ format: "paperback"
+ language: :english
+
+PUBLISHED_EBOOK: &PUBLISHED_EBOOK
+ <<: *PUBLISHED
+ format: "ebook"
+
+awdr:
+ <<: *PUBLISHED_PAPERBACK
+ name: "Agile Web Development with Rails"
+
+rfr:
+ <<: *PUBLISHED_EBOOK
+ name: "Ruby for Rails"