Created
September 2, 2021 22:32
-
-
Save thisismydesign/3a85306ffddd71656cf5f13587602334 to your computer and use it in GitHub Desktop.
Ruby: Use factories for your webmocks /5
This file contains hidden or 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: 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