Skip to content

Instantly share code, notes, and snippets.

@thisismydesign
Created September 2, 2021 22:32
Show Gist options
  • Save thisismydesign/3a85306ffddd71656cf5f13587602334 to your computer and use it in GitHub Desktop.
Save thisismydesign/3a85306ffddd71656cf5f13587602334 to your computer and use it in GitHub Desktop.
Ruby: Use factories for your webmocks /5
FactoryBot.define do
factory :xyz_service_get_entities_response, class: OpenStruct do
skip_create
initialize_with do
new(attributes.except(:body).merge({ body: attributes[:body].to_json }))
end
transient do
...
end
status { 200 }
body do
{
data: {
...
}
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment