This repository was archived by the owner on Jul 12, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
created rit add workspace command #809
created rit add workspace command #809
Changes from all commits
b6705fd
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One detail, on a success case, you want to check if the workspace entry was actually added to
~/.rit/formula_workspaces.json
so maybe you do not want to mock the workspace addedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I wanted to check that.
My unit it's until I called the method
a.workspace.Add(wspace)
after that the behavior ins't responsability of this method. Because of this I mocked my test.What do you think?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do agree with you, lately we have been trying to adopt a more functional-like approach on our tests. But your argument is good as well, if you intend to continue with the mock, then maybe it is best to test that it has been called with the right arguments to ensure a thorough test. Check out assertCalled
https://godoc.org/github.com/stretchr/testify/mock#Mock.AssertCalled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right, I can mock my test, but at least a need to guarantee I'm passing the right parameters.
Thanks for the observation! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, this is even better than what I suggested 😄 will be recommending this to the team