Howto configure Github Actions to run Rubocop, Rspec and Capybara
October 1, 2020
Usually I'm working with CircleCI - it's good for private projects. But new feature from Github is free for public repo's so I've decided to give it a try. GitHub Actions makes it easy to automate all your software workflows - CI/CD. Build, test, and deploy your code right from GitHub. Here is my example of configuration for Ruby on Rails project to run Rubocop, RSpec unit and RSpec Capybara feature specs. I guess ENV part can be decoupled and moved outside, but for now I'm ok with it. Happy coding!
Howto read and save gmail attachments using Gmail API
September 10, 2019
ruby installation error "reading '/dev/f9/'"
November 13, 2018
Any issues with ruby build e.g. when doing rbenv install 2.5.1 or other ruby versions can be caused by antivirus software. It was Avira in my case. Just disable it.
DB search for a value which can be nil/blank
November 13, 2018
Extend model with context that contains validations
July 28, 2018
Imagine that you need conditional validation and you can't use ReForm or other form objects while extending third-party logic.
Then you can add custom context to model instance:
Validatesmethod is not available in the module context so we need to call it in the model context.
Extract value from resulting array to a method
July 22, 2018
For example, we have method output like:
We can use it this way:
do_calculationswe can access result by calling method
Sandi Metz best practise advices about application design
April 17, 2018
1) If you do design too early, you'll waste your efforts.
2) If you never do design, your code will become a painful mess.
3) A time will come when investing in design will save you money.
4) Simple procedures require little design and are cheap to maintain.
5) Procedures become more complex over time, and more expensive to maintain.
6) Object-oriented code is more cost-effective than complex procedural code.
7) The procedures that are most important to your domain change more than those that are incidental to your domain.
8) The procedures that are important to your domain increase in complexity faster than other code.
9) It's difficult to be aware of the exact moment when your application crosses the design payoff line.
10) You become aware that you have passed the design payoff line because velocity slows and suffering increases.
11) The most important code will be the most out-of-control by the time you realize you've passed the design payoff line.
12) Moderately complex procedures are easy to convert to OO.
13) Extremely complex procedures are more difficult to convert to OO.
14) Your attempts to convert moderately complicated procedures to OO generally succeed.
15) Your attempts to convert extremely complicated procedures to OO often fail.