I need to understand this line of code in Rspec.
create(:practice, creator: create(:physician, password: "password123", password_confirmation: "password123" ), phone: "+1 (555) 555-5554", office: "+1 (555) 555-5555", clinic_key: "abc123")
What is this create function. It is not built in rails or ruby function. Do we have its documentation?
It looks like create
is called from FactoryBot
.
Usually you need to create object like FactoryBot.create(:user)
but if you configure factory bot
RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
end
(see this) you can omit FactoryBot
and use short variant create(:user)
.
So your code creates factory practice
with creator which is created by another factory physician
.