aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/fixtures/parrots.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/parrots.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/parrots.yml')
-rw-r--r--activerecord/test/fixtures/parrots.yml8
1 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/test/fixtures/parrots.yml b/activerecord/test/fixtures/parrots.yml
index 8425ef98e0..4f0a090e03 100644
--- a/activerecord/test/fixtures/parrots.yml
+++ b/activerecord/test/fixtures/parrots.yml
@@ -1,3 +1,9 @@
+_fixture:
+ ignore: DEAD_PARROT
+
+DEAD_PARROT: &DEAD_PARROT
+ parrot_sti_class: DeadParrot
+
george:
name: "Curious George"
treasures: diamond, sapphire
@@ -17,7 +23,7 @@ polly:
name: $LABEL
killer: blackbeard
treasures: sapphire, ruby
- parrot_sti_class: DeadParrot
+ <<: *DEAD_PARROT
DEFAULTS: &DEFAULTS
treasures: sapphire, ruby