Machinist blueprints: Do not set associations without blocks
TL;DR In blueprints, always wrap associations in blocks.
Copy# Broken Task.blueprint(:vacation) do project Project.make(:vacation) hours 8 accounting_method 'none' end
Copy# Correct Task.blueprint(:vacation) do project { Project.make(:vacation) } hours 8 accounting_method 'none' end
Without the block, Project.make
will only run once when the blueprint is parsed (usually when RSpec is loaded), which is not what you want.
By refactoring problematic code and creating automated tests, makandra can vastly improve the maintainability of your Rails application.