Using the id of subject{create()} in rspec

Viewed 175

I'm pretty new to rspec so I'm not sure how to word this properly so I'll give an example of my situation instead:

subject(:test) { SomeModel.create(name: name, depend: depend) }
let(:name){ "test name" }
let(:depend){ create(:depend, //something here with id of creation of SomeModel) }

Depend belongs to SomeModel and so I need the id of SomeModel to create Depend. Is there some way of retrieving the id of the SomeModel I created in the first line? Sorry if this is very unclear as I'm not too sure how to word it.

0 Answers
Related