Skip to content

Commit

Permalink
Add support for factory_bot's default suffixed pattern (#59)
Browse files Browse the repository at this point in the history
From ctran/annotate_models#994. Credit goes to
@meric426.
  • Loading branch information
drwl authored Sep 16, 2023
1 parent 1ae4ec6 commit 76ccda9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/annotate_rb/model_annotator/pattern_getter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ def factory_files(root_directory)
File.join(root_directory, FilePatterns::FACTORY_BOT_SPEC_DIR, "%TABLE_NAME%.rb"), # (new style)
File.join(root_directory, FilePatterns::FACTORY_BOT_TEST_DIR, "%PLURALIZED_MODEL_NAME%.rb"), # (new style)
File.join(root_directory, FilePatterns::FACTORY_BOT_SPEC_DIR, "%PLURALIZED_MODEL_NAME%.rb"), # (new style)
File.join(root_directory, FilePatterns::FACTORY_BOT_TEST_DIR, "%PLURALIZED_MODEL_NAME%_factory.rb"), # (new style)
File.join(root_directory, FilePatterns::FACTORY_BOT_SPEC_DIR, "%PLURALIZED_MODEL_NAME%_factory.rb"), # (new style)
File.join(root_directory, FilePatterns::FABRICATORS_TEST_DIR, "%MODEL_NAME%_fabricator.rb"),
File.join(root_directory, FilePatterns::FABRICATORS_SPEC_DIR, "%MODEL_NAME%_fabricator.rb")
]
Expand Down
2 changes: 2 additions & 0 deletions spec/lib/annotate_rb/model_annotator/pattern_getter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
"spec/factories/%TABLE_NAME%.rb",
"test/factories/%PLURALIZED_MODEL_NAME%.rb",
"spec/factories/%PLURALIZED_MODEL_NAME%.rb",
"test/factories/%PLURALIZED_MODEL_NAME%_factory.rb",
"spec/factories/%PLURALIZED_MODEL_NAME%_factory.rb",
"test/fabricators/%MODEL_NAME%_fabricator.rb",
"spec/fabricators/%MODEL_NAME%_fabricator.rb"
])
Expand Down

0 comments on commit 76ccda9

Please sign in to comment.