Last active
September 2, 2021 21:44
-
-
Save thisismydesign/46e87026185fef128e4c13bc75020f1a to your computer and use it in GitHub Desktop.
Ruby: Use factories for your webmocks /1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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