Optimizing CircleCI Configuration: Minimize config.yml size with Dynamic Configuration

We have a wdio-based automation project that does end-to-end functional testing. We use CircleCI as the CI/CD tool to run automation regression. When setting up a project with CircleCI, we need to enter all configuration details in the config.yml file under the .circleci folder. Earlier, we only had staging regression and prod regression jobs and their respective workflows in the config.yml file. As mentioned in this article, we also started doing screenshot testing for our application. With time, our configuration file expanded and became cluttered, accommodating various workflows like staging sanity, staging regression, prod regression, performance score

Type-checking in Ruby 3 using RBS

Ruby 3 has introduced a new syntax language for dynamic typing called RBS. In short, it is a language that we can use to describe the data types used in a Ruby class. We can define the data type of variables and the return type of methods used in a class using RBS. Why do we need type-checking? Since Ruby is a dynamically typed language, we don't need to define the data type of the variables we are using. Ruby automatically assigns a type based on the variable's value at runtime. Let's take the below class as an example. # basic_

Rails 7.1 ActiveRecord adds normalizes API for attribute values

Sometimes you may want to standardize the data before saving it to the database. For example, downcasing emails, removing any leading and trailing whitespaces, and so on. Rails 7.1 adds ActiveRecord::Base::normalizes API, which allows you to normalize attribute values to a common format before saving them to the database. This can help improve the integrity and consistency of your data and make it simpler to query records based on attribute values. Before Rails 7.1 Normalizing it in before_validation or before_save callback class User < ActiveRecord::Base before_validation do self.name = name.downcase.titleize

Setup Image Comparison Service of WDIO to make UI Testing more impactful

This blog helps to configure visual regression testing using wdio-image-comparison-service.

All about "Data" Simple Immutable Value Objects in Ruby 3.2

In Ruby 3.2, a new class Data was introduced as a way to define simple immutable value objects. A value object is a type of object that represents a value in a program, such as a point in 2D space or a date. The main advantage of value objects is that they are easy to understand, simple to use, and can improve the readability and maintainability of code. The proposal to add Data class was accepted by Matz on the Ruby forum here. How does it work?Using the newly defined class Data we can create a simple immutable

Ruby 3.2.0 enhances Regexp performance and security with ReDoS protections

What is ReDoS? Regular expression Denial of Service (ReDoS) is a security vulnerability that can occur in a regular expression (regex) when the regex is applied to a long string. This attack is designed to make a system or network unavailable to its intended users. An example occurrence of a ReDoS Imagine that a website has a form that accepts user input and uses a regex to validate the input. The regex is designed to only allow alphanumeric characters in the input, so it looks like this: /^[a-zA-Z0-9]+$/. An attacker could potentially craft a string of input that consists of

Improvements to in_order_of active record query method in Rails 7.1

Rails 7 has introduced the in_order_of method which allows to sort records in a specific order. There is a detailed explanation of it in the article Rails 7 adds in_order_of for ActiveRecord::QueryMethods and Enumerable. This is a follow-up article to that one, in which we will explore how the in_order_of method has been improved in Rails 7.1. Rails 7 adds in_order_of for ActiveRecord::QueryMethods and EnumerableRails 7 has added in_order_of method for ActiveRecord::QueryMethods and Enumerable to retrieve the data in an explicit order.Kiprosh BlogsSupriya Laxman MedankarAllows

Rails 7: ActiveStorage::Streaming improves streaming from the controller

In the era of content consumption where streaming platforms like YouTube and Netflix have millions of concurrent users, no one wants to wait more than a minute to consume anything, it must be available instantly! Streaming becomes a need in this situation. While downloading requires waiting until the entire file has been downloaded on your computer, streaming allows you to view downloaded portions of the material on the fly. This significantly reduces the waiting time. Let's see with the help of a small example how streaming was handled before Rails 7 and what changed after Rails 7. With Rails <

Rails 7.1 - Raises on assignment to readonly attributes

Rails 7.1 adds the raise_on_assign_to_attr_readonly config to config.active_record that is used to raise ActiveRecord::ReadonlyAttributeError error on assignment to attr_readonly attributes. The previous behavior would allow assignment but silently not persist changes to the database. Configuring config.active_record.raise_on_assign_to_attr_readonly In a newly created Rails 7.1 application, config.load_defaults 7.1 is set by default in application.rb. The default value of raise_on_assign_to_attr_readonly for config.load_defaults 7.1 is true and for config.load_defaults < 7.1

A quick dive into the new query_constraints config introduced in Rails 7.1

The query_constraints config introduced in Rails 7.1 is helpful for pre-setting the DB query constraints on the ActiveRecord models.