Author: heridev

Here you have a quick example: Let's begin with the service for that. app/services/format_response_with_active_model_errors.rb [ruby] class FormatResponseWithActiveModelErrors extend ActiveModel::Naming def initialize @errors = ActiveModel::Errors.new(self) end def valid? errors.empty? end attr_reader :errors attr_accessor :response def add_error_message!(field_name:,...

In case you are having troubles to use the [ruby] expect_any_instance_of [/ruby] From Rspec, guess what, it is not only you, many of us have faced the same troubles before, you can see it here in the thread discussion https://github.com/rspec/rspec-mocks/issues/910 I really agree with this argument: The name of the method...

Ahora una triste historia para programadores/arquitectos de software: Erase una vez una clase llamada `God` la cual implementaba el método `create_planet` [ruby] Class God def self.create_planet Earth.new end end [/ruby] Cierto día fue invocada por primera vez [ruby] @earth = God.create_planet [/ruby] La instancia Earth(Tierra) era maravillosa y resplandeciente, llena...