You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for this nice gem! 馃槃
In past I used the Interactor gem quite a lot, I recently switched to Actor and I find it a nice improvement.
As in the subject: perhaps it could be nice to suggest some testing strategies for actors.
For example, with RSpec I recently wrote something like this:
RSpec.describeParseFileName,type: :actordodescribe".result"dosubject(:result){described_class.result(file_name:)}context"with a valid file_name"dolet(:file_name){"sample_file_name_20221229010101.csv"}it{expect(result).tobe_a_success}it"parses the file_name and returns an Hash"doexpected_hash={prefix: :sample,name: "file_name",timestamp: Time.zone.strptime("20221229010101","%Y%m%d%H%M%S")}expect(result.formatted_attributes).toeqexpected_hashendendcontext"with an invalid file_name"dolet(:file_name){"wrong_name.csv"}it{expect(result).tobe_a_failure}it{expect(result.error).toeq"Invalid format for \"#{file_name}\""}endendend
In this case I preferred to use result to avoid checking exceptions.
WDYT?
The text was updated successfully, but these errors were encountered:
Thank you for this nice gem! 馃槃
In past I used the Interactor gem quite a lot, I recently switched to Actor and I find it a nice improvement.
As in the subject: perhaps it could be nice to suggest some testing strategies for actors.
For example, with RSpec I recently wrote something like this:
In this case I preferred to use
result
to avoid checking exceptions.WDYT?
The text was updated successfully, but these errors were encountered: