Skip to content

Instantly share code, notes, and snippets.

@thisismydesign
Last active September 2, 2021 21:44
Show Gist options
  • Save thisismydesign/46e87026185fef128e4c13bc75020f1a to your computer and use it in GitHub Desktop.
Save thisismydesign/46e87026185fef128e4c13bc75020f1a to your computer and use it in GitHub Desktop.
Ruby: Use factories for your webmocks /1
FactoryBot.define do
factory :xyz_service_get_entities_response, class: Hash do
skip_create
initialize_with { { body: attributes[:body].to_json }.stringify_keys }
body do
{
data: [
{ key: SecureRandom.hex, name: Faker::Lorem.word },
{ key: SecureRandom.hex, name: Faker::Lorem.word }
]
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment