Technical writings of Shkrt
Often, when approaching coding problems, we face some issues with a framework or some libraries. First, we try to solve them ourselves, digging into the source code, then begin to ask questions on GitHub, related Slack channels, searching StackOverflow and what not. Usually, I notice that many developers ask that kind of questions in a manner, that makes hard to understand, what exactly is going on. In such cases, there is often even no way to reproduce the described bug. So, let’s look at an example. Let’s imagine, that we have some web application, written using Ruby on Rails, backed by ActiveRecord ORM. We tried to implement image uploads using Shrine library, and something just does not work as expected. How do we make the description of this situation understandable and give readers the possibility to reproduce described behavior?
so they can clone it, launch project and make suggestions. This approach has two main drawbacks:
The file will load only needed libraries, and replace some external services by their mocks. So this is the example of the second approach.
In the given examples we loaded all needed libraries manually, set up in-memory SQLite database, set our uploader and model and then demonstrated image upload. There are really no any issue or bug, but that way we can describe most of the problems that we face during the development process. We can even add a testing library to this setup, but in this case, everything is clear and reproducible even without minitest or rspec.
[workflow
]