mudasobwa

mudasobwa

Creator of Cure

Mocks Are Your Friends, Not Your Servants

Łukasz wrote a great article, 'guiding not ruling’ the way of writing tests. I agree with everything, short of his attitude to mocks. The furter discussion revealed that we treat mocks in an absolutely different manner.

I :heart: mocks, and here is why.

Most Liked

felix-starman

felix-starman

I need to restart my work on DoubleAgent. I was discouraged by all the mock libraries that came out and I never had time to come back and finish it, but maybe this will give me the kick in the pants to do it.

I generally agree with all of the things you said here. My only addition to the conversation is to not call it a mock anymore since there’s too much baggage around it or people misunderstand it.

I like the framing of it as something that collaboratively works with you to validate the contract from the inside.

I have thought similarly for a long time and that was part of why after using double and working with its creator/mantainer in the past I thought a better name would be double agent, because it’s running in the implementation but it’s working for you.

I also have a whole lot of plans for how it can be iteratively employed and guide you from a very simple non-ideal approach to a fully speced out behaviour where all of the best features come about and become easy from following the best practices.

It’s a great article. Thank you for writing it

code-shoily

code-shoily

Just shared this with colleagues. Loved this article.

Where Next?

Popular in Blog Posts Top

AstonJ
Elixir Blog Posts How to use this section You can post links to your blog posts either in one of the Official Blog Posts threads, or, vi...
New
bram209
Hello everyone, I just published my first blog post ever. I am learning Elixir, OTP & Phoenix and wanted to start a blog for a while...
New
AstonJ
Update: How to use the blogs section You can post in one of the Official Blog Posts threads (like this one), or, via Devtalk and a new t...
New
rms.mrcs
https://medium.com/the-realreal-product-tech-blog/monitoring-hackney-connection-pools-with-telemetry-3aaeafa8eeb8 Hi, everyone! In this ...
New
StuntProgrammer
Hey there! This is the first article in what I hope will be a nice series about how I built (and am building) Lofi Limo. If you have any ...
New
axelson
I talk about how I really like to use runtime configuration and discuss some common pitfalls of configuration in Elixir.
New
brainlid
This post asks if we can remove Alpine from the PETAL stack. Can we do everything we need with just LiveView? Also, let’s explore an area...
New
New
brainlid
Elixir has a built-in Zip library that comes with OTP. This post explores how to use the zip module and asks the important question: “Is ...
New
psantos
Just wrote a new blog post about how to deploy a Phoenix app using Kamal 2. Check it out and let me know what do you think: https://blog...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127089 1222
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52673 488
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement