He estado leyendo un libro muy interesante que se llama, “A mind for numbers” de Barbara Oakley, Ph.D.
En el libro me topé con una técnica, muy interesante que le llaman “Memory Palace”, me llamó mucho la atención, porque la técnica esta realmente...Read more
Did you complete a Ruby on Rails tutorial, but want a more focused practice on Active Record?
Do you know other languages and frameworks and want to learn the basics of the magic on Active Record?
As I said in the last post as ruby/rails developers is very common to start our projects with something very similar to the Rails scaffold…
For us, ruby/rails developers is very common to start our projects/apps with something very similar to the Rails scaffold….
Are you looking for a way of implementing a read-more behavior but based on the number of lines instead of on the number of words?
If you are thinking in trying Stimulus.js in your project, maybe this little “before and after” can help you to decide.
As I wrote in the previous article about using end-to-end tests in your TDD cycle… This kind of tests can be very helpful in some situations, and I think that is a good thing to try if it works for you and your current project.
Maybe you have always thought that TDD is about making unit/micro test first… And that is true for some people, other people feel more comfortable starting the cycle with an end-to-end test… And you could be one of them.
But sometimes is not very clear how to do it, because when you are doing TDD…
If you are here, maybe it is because you also like fast tests!… I really like fast tests, and for that reason (and some others…) I always try to decouple my code from Rails and other frameworks…
I have already told you that when you are doing TDD with a use case approach, is better to use mocks to design your dependencies instead of been tight to a given interface, because this can help you to decouple from your dependencies following the Dependency Inversion principle.
Have you had started a project trying to do TDD “the right way”, writing “unit tests” for every class and method, trying to hit that famous 100% coverage….
… And then few months later, rewriting many of them just for a little change or refactor!
Have you been in that situation when you are “mocking” something and you feel that you are not testing anything?
I have already told you that organizing your code in use cases can help you to start your projects using TDD, and also I gave you a tip on how you can organize your app in use cases.
But even if you know what your code should do, is not so obvious how you should structure your tests…
I have already told you that organizing your code in use cases can help you to start your projects using TDD … And other people also recommend it for other purposes… You really should try it!
The problem is, that is not really obvious how to do it!…
After reading a lot of questions and answers on TDD and unit testing, are you still struggling to find the answer to… Where to start from?…
Are you new to mock objects? Are you trying to learn how to use them? Are you looking for some “hello world” examples for Mock Objects?
Mock objects can be a really good tool sometimes, but not always. This is a guide, to help you learn how and when you can use them.
Do you want to know how you can use a test double or mock to test the creation of a record? Are you looking for an example of using mocks?… Maybe this post can help you =)
There are different practices, that I know, to test that an email was sent in Rails…
Do you want to know how dependency injection can help you and your team to actually doing less work?
I have an story for you…
Is a common problem in a Rails app to have very slow test suites. There are a lot of test suites that need more than 10 or even 30 minutes to run!…
Is your app in this group?
Maybe you or your team have decided to code “in the right way” and go hard on TDD and unit testing on your Rails app…
Are you struggling trying to define what to test on your unit tests? Maybe is easier for you to identify what to test on your feature tests or system tests because the user story or approval criteria, in a certain way “tells you” what to test or what is expected to happen.
But with your unit tests is different…
Do you struggle with understanding what to test and how to test it?… Maybe you know that “you need to test the behavior of your objects”, but of those behaviors, what do you test?, and how do you test it?… are you looking for some kind of simple steps or methodology to apply? a repeatable process?
Do you have problems deciding what to test or how to test you rails app? Don’t worry, this is a very common problem… I think that there are a lot of reasons why this is hard for many people, but I have found that one of the problems is that are many ways to do it.
Imagine that you have the next controller action that works, but when you see it you feel that you can make it cleaner.
Estas preguntas me vienen constantemente, y hoy fue una de esas veces… Estuve trabajando en https://www.briq.mx/ construyendo una estructura de datos que debería tener información de varias fuentes de la aplicación.
En los últimos proyectos que he trabajado, tanto solo como en equipo, poco a poco he ido descubriendo ciertas practicas o reglas que usamos y que quiero compartir porque creo que también te pueden servir.
En esta idea de “Rails is not my app” es necesario definir cuales son las cosas que va hacer tu aplicación y cuales va a delegar.
This is are the slides of a presentation that I gave at the Ruby Meetup Monterrey, the last year.
Maybe some of you know that I am planning to get marry the next year. If not know you know =).
Talking about object oriented programming, Sandy Metz propose that when you are testing “outgoing messages with side effects” what you should do is just assert that the “outgoing message” has been sent. For example in ruby we can do something like…
Maybe you are in this transition to become a professional programmer (congrats!!) and you have seen that if you want to be “a professional programmer” you have to use TDD and test all your code.
Esta es una pequeña guía aprenderas lo suficiente de git para integrarte a tu equipo de desarrollo.
I want to show you a way you can “draw a line” between your application “main logic” and your Rails controllers.
Lately I have been working with Abi in a way to separate the core of an application in small modules using rails just as a platform that uses those small modules/programs to build a real web application.
The validations of your ActiveRecord models look very convenient, because they are easy to use and have a pretty DSL. Use them is the “rails way” so you think that is what you must use. But…
Las validaciones de tus modelos de
ActiveRecord parecieran muy
convenientes, porque son muy fáciles de usar, tiene un DSL muy
entendible y rails te las pone ahí a la mano para que las uses. Pero
esto no dura para siempre.
Recuerdo que de niño en la escuela de música mi maestro siempre mencionaba una frase de Arturo Sandoval (uno de los mejores trompetistas en la actualidad y de todos los tiempos) que decía: “Para tocar hay que tocar”. Siempre mencionaba esto para hacerme entender que la única forma de poder tocar bien un instrumento musical, es practicando.
Maybe there is a lot of people know this solution, but before today I didn’t know it, so I want to share this =).
Imagine that you want that the home page of your app for an authenticated user, to be a Dashboard with stadistics or something special, but you want to have an informative page for the people that is not authenticated.
Like a year ago, my style to write cucumber test was to use the cucumber’s web steps, the most I can, and the results were some tests like this one.
What you need to have an object compliant with the handler API, is to respond to the call method which receives an instance of ActionView::Template and should return a string with valid Ruby code.
Maybe you can join the newsletter and we can try together.