Should I be writing feature or request specs?
I’ve been writing model specs for a while now and I’m gradually moving towards integration testing. Right now, I’m looking at the best way to test the output of my ActiveAdmin dashboard but I’m unsure which is the best type of spec for the job.
How can I write these services using SOLID and keep them easy to test?
I am trying to write a couple of classes using SOLID principles and having some trouble.
Should you mock key-value stores/aggregators
I’ve always been taught that your tests should run in isolation, and other than a db for ActiveRecord etc., your tests should not rely on any external software/services. e.g. I always mock my other web-service responses but what about responses from web based key-value stores and aggregators like elasticsearch, redis, and statsd? My intuition would be to mock those as well as I am not testing if they work I am testing my apps IO with them. However I see examples around where people uses namespace strategies to test their elasticsearch and statsd related code.
Should you mock key-value stores/aggregators
I’ve always been taught that your tests should run in isolation, and other than a db for ActiveRecord etc., your tests should not rely on any external software/services. e.g. I always mock my other web-service responses but what about responses from web based key-value stores and aggregators like elasticsearch, redis, and statsd? My intuition would be to mock those as well as I am not testing if they work I am testing my apps IO with them. However I see examples around where people uses namespace strategies to test their elasticsearch and statsd related code.
Replace repeated timestamp with variable in tests
I have couple hundred tests and I work with date/time a lot. In some tests, I aim for output format, elsewhere, I check date ranges. Therefore, my tests have lots of these: