Build model with nested model in rspec integration test
- by user1116573
I understand that I can do something like in rspec:
let(:project) { Project.new }
but in my app a project accepts_nested_attributes_for tasks and when I generate the Project form I build a task along with it using:
@project = Project.new
@project.tasks.build
I need something like:
let(:project) { Project.new.tasks.build }
but that doesn't seem to work.
How can I do this as a let in my rspec test?