-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUGFIX: UserStat spec was over ambitious with its mocking
- Loading branch information
1 parent
b703d8c
commit 6befdce
Showing
2 changed files
with
19 additions
and
7 deletions.
There are no files selected for viewing
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
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
1 comment
on commit 6befdce
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.
This change moves your mock from the service layer to a private method in the unit under test. That's not usually recommended. The former specifies the contract with redis when various events occur, which is what you ultimately care about.
I suppose it's possible you're really looking for a cache abstraction layer that's implemented by redis in production, but by an in-memory or mock object in your tests.
A bit of a premature optimization here? Not very expensive to make a string.